I don’t understand an idea of AsyncResult class. From the tutorial I have learned that it works just as FutureTask class (but AsyncResult is serializable, so it can be send to local or remote client). However, doc says that this class' methods should not be called so I can only create and return instance of this class:
@Asynchronous
public Future<String> processPayment(Order order) throws PaymentException {
...
String status = ...;
return new AsyncResult<String>(status);
}
So what kind of object will client get?
Can I write
@Asynchronous
public AsyncResult<String> processPayment...
?.
Will container do something to cancel asynchronous task after invoking AsyncResult’s/Future's cancel(false)
method?
EDIT: I have found answer in this thread.