[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [ecf-dev] Async-Methods

On 11/22/2010 12:59 PM, Eugen Reiswich wrote:
> Hi folks, 
> 
> I just found out that ECF also supports async-methods  and tried to set
> up a small example using the XMPP-provider. Unfortunately I get an
> exception trying to call async-methods: java.lang.NoSuchMethodException.
> 
> Just to make sure I got everything right:
> 
> 1. I have a service called IExampleService:
> public interface IExampleService {
> public String getName();
> }
> 
> 2. I've created a second Interface: IExampleServiceAsync in the same
> package:
> public interface IExampleServiceAsync extends IAsyncRemoteServiceProxy {
> public void getNameAsync(String param, IAsyncCallback<String> callback);
> } 

Same package and same bundle?

But your original takes no String parameter. thus try:

public void getNameAsync(IAsyncCallback<String> callback);

> 3. My ServiceImpl implements both interfaces (I've also tried it without
> implementing IExampleServiceAsync, but same exception):
> public class ExampleServiceImpl implements IExampleService,
> IExampleServiceAsync {
> @Override
> public String getName() {
> return"ExampleService";
> }
> 
> @Override
> public void getNameAsync(String param, IAsyncCallback<String> callback) {
> System.out.println("ExampleServiceImpl.getNameAsync()");
> 
> callback.onSuccess(getName() + "yeahhh!!!");
> }
> }

Your service does not have to implement the *Async interface.

> 4. I've registered the service twice using only one interface:
> getRemoteServiceContainerAdapter().registerRemoteService(new String[] {
> IExampleService.class.getName()}, service,
> null);

No need to register the service with async.

Markus