Package org.apache.thrift.async
Class AsyncMethodFutureAdapter<T>
java.lang.Object
org.apache.thrift.async.AsyncMethodFutureAdapter<T>
- Type Parameters:
T- return type (can beVoid).
- All Implemented Interfaces:
AsyncMethodCallback<T>
A simple adapter that bridges
AsyncMethodCallback with CompletableFuture-returning style clients. Compiler generated code will invoke this adapter to
implement FutureClients.-
Method Summary
Modifier and TypeMethodDescriptionstatic <T> AsyncMethodFutureAdapter<T>create()voidonComplete(T response) This method will be called when the remote side has completed invoking your method call and the result is fully read.voidThis method will be called when there is either an unexpected client-side exception like an IOException or else when the remote method raises an exception, either declared in the IDL or due to an unexpected server-side error.
-
Method Details
-
create
-
getFuture
-
onComplete
Description copied from interface:AsyncMethodCallbackThis method will be called when the remote side has completed invoking your method call and the result is fully read. Foronewaymethod calls, this method will be called as soon as we have completed writing out the request.- Specified by:
onCompletein interfaceAsyncMethodCallback<T>- Parameters:
response- The return value of the asynchronously invoked method;nullfor void methods which includesonewaymethods.
-
onError
Description copied from interface:AsyncMethodCallbackThis method will be called when there is either an unexpected client-side exception like an IOException or else when the remote method raises an exception, either declared in the IDL or due to an unexpected server-side error.- Specified by:
onErrorin interfaceAsyncMethodCallback<T>- Parameters:
exception- The exception encountered processing the the asynchronous method call, may be a local exception or an unmarshalled remote exception.
-