Class AsyncMethodCallbacks
- java.lang.Object
-
- com.linecorp.armeria.common.thrift.AsyncMethodCallbacks
-
public final class AsyncMethodCallbacks extends Object
A utility class that bridges the gap betweenCompletionStageandAsyncMethodCallback.
-
-
Method Summary
Modifier and Type Method Description static 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 Detail
-
transfer
public static <T> void transfer(CompletionStage<T> src, AsyncMethodCallback<? super T> dest)
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
public static void invokeOnError(AsyncMethodCallback<?> callback, Throwable cause)
InvokesAsyncMethodCallback.onError(Exception). If the specifiedcauseis not anException, it will be wrapped with aCompletionException.
-
-