String result = dataProcessor.processData(data);
System.out.println("Sync result="+result);
System.out.println();
// See if we've got an async interface and if so, use it
if (dataProcessor instanceof IDataProcessorAsync) {
IDataProcessorAsync dpAsync = (IDataProcessorAsync) dataProcessor;
System.out.println("Got async data processor on client");
IAsyncCallback<String> callback = new IAsyncCallback<String>() {
public void onSuccess(String result) {
System.out.println("Async result="+result);
}
public void onFailure(Throwable exception) {
System.out.println("Async invoke failed with exception");
if (exception != null) exception.printStackTrace();
}
};
// Now invoke async
dpAsync.processDataAsync(data, callback);
}
}