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 void
invokeOnError
(AsyncMethodCallback<?> callback, Throwable cause) static <T> void
transfer
(CompletionStage<T> src, AsyncMethodCallback<? super T> dest) Adds a callback that transfers the outcome of the specifiedCompletionStage
to the specifiedAsyncMethodCallback
.
-
Method Details
-
transfer
Adds a callback that transfers the outcome of the specifiedCompletionStage
to 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 specifiedcause
is not anException
, it will be wrapped with aCompletionException
.
-