Closed
Description
AsyncResult<ResultClass> doSmth(String param1);
Usage:
AsyncResult<ResultClass> result = apiClient.getSmth("foo");
result.onSuccess(new ResultCallback<ResultClass>(ResultClass result) { ... } );
result.onError(new ErrorCallback<ErroClass>(ErrorClass err) { ... } );
result.onFinally(new Runnable() { ... } );
Also we can do sync call:
ResultClass res = result.doSync();
It is very close to Guava ListenableFutures https://code.google.com/p/guava-libraries/wiki/ListenableFutureExplained. The only difference that ListenableFuture cannot execute itself and you have to execute them with another object.
I also like that with Guava ListenableFutures async operations can be merged to be executed in parallel or one by one.
Metadata
Metadata
Assignees
Labels
No labels