Class AsyncMethodCallbacks
java.lang.Object
com.linecorp.armeria.common.thrift.AsyncMethodCallbacks
A utility class that bridges the gap between
CompletionStage and AsyncMethodCallback.-
Method Summary
Modifier and TypeMethodDescriptionstatic voidinvokeOnError(AsyncMethodCallback<?> callback, Throwable cause)static <T> voidtransfer(CompletionStage<T> src, AsyncMethodCallback<? super T> dest)Adds a callback that transfers the outcome of the specifiedCompletionStageto the specifiedAsyncMethodCallback.
-
Method Details
-
transfer
Adds a callback that transfers the outcome of the specifiedCompletionStageto the specifiedAsyncMethodCallback.> public class MyThriftService implements ThriftService.AsyncIface { > @Override > public void myServiceMethod(AsyncMethodCallback<MyResult> callback) { > final CompletableFuture<MyResult> future = ...; > AsyncMethodCallbacks.transfer(future, callback); > } > } -
invokeOnError
InvokesAsyncMethodCallback.onError(Exception). If the specifiedcauseis not anException, it will be wrapped with aCompletionException.
-