Package com.linecorp.armeria.common
Interface RpcResponse
-
- All Superinterfaces:
CompletionStage<Object>
,Future<Object>
,Response
- All Known Implementing Classes:
DefaultRpcResponse
public interface RpcResponse extends Response, Future<Object>, CompletionStage<Object>
An RPCResponse
. It is aCompletionStage
whose result signifies the return value of an RPC call.
-
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description Throwable
cause()
Returns the cause of the failure if thisRpcResponse
completed exceptionally.default CompletableFuture<?>
completionFuture()
Returns aCompletableFuture
which completes when thisRpcResponse
completes.static RpcResponse
from(CompletionStage<?> stage)
Creates a newRpcResponse
that is completed successfully or exceptionally based on the completion of the specifiedCompletionStage
.Object
getNow(Object valueIfAbsent)
Returns the specifiedvalueIfAbsent
when not complete, or returns the result value or throws an exception when complete.boolean
isCompletedExceptionally()
Returnstrue
if thisRpcResponse
completed exceptionally.Object
join()
Returns the result value if completed successfully or throws an unchecked exception if completed exceptionally.static RpcResponse
of(Object value)
Creates a new successfully completeRpcResponse
.static RpcResponse
ofFailure(Throwable cause)
Creates a new exceptionally completeRpcResponse
.-
Methods inherited from interface java.util.concurrent.CompletionStage
acceptEither, acceptEitherAsync, acceptEitherAsync, applyToEither, applyToEitherAsync, applyToEitherAsync, exceptionally, handle, handleAsync, handleAsync, runAfterBoth, runAfterBothAsync, runAfterBothAsync, runAfterEither, runAfterEitherAsync, runAfterEitherAsync, thenAccept, thenAcceptAsync, thenAcceptAsync, thenAcceptBoth, thenAcceptBothAsync, thenAcceptBothAsync, thenApply, thenApplyAsync, thenApplyAsync, thenCombine, thenCombineAsync, thenCombineAsync, thenCompose, thenComposeAsync, thenComposeAsync, thenRun, thenRunAsync, thenRunAsync, toCompletableFuture, whenComplete, whenCompleteAsync, whenCompleteAsync
-
Methods inherited from interface com.linecorp.armeria.common.Response
closeFuture
-
-
-
-
Method Detail
-
of
static RpcResponse of(@Nullable Object value)
Creates a new successfully completeRpcResponse
.
-
ofFailure
static RpcResponse ofFailure(Throwable cause)
Creates a new exceptionally completeRpcResponse
.
-
from
static RpcResponse from(CompletionStage<?> stage)
Creates a newRpcResponse
that is completed successfully or exceptionally based on the completion of the specifiedCompletionStage
.
-
join
Object join()
Returns the result value if completed successfully or throws an unchecked exception if completed exceptionally.- See Also:
CompletableFuture.join()
-
getNow
Object getNow(Object valueIfAbsent)
Returns the specifiedvalueIfAbsent
when not complete, or returns the result value or throws an exception when complete.- See Also:
CompletableFuture.getNow(Object)
-
cause
@Nullable Throwable cause()
Returns the cause of the failure if thisRpcResponse
completed exceptionally.- Returns:
- the cause, or
null
if thisRpcResponse
completed successfully or did not complete yet.
-
isCompletedExceptionally
boolean isCompletedExceptionally()
Returnstrue
if thisRpcResponse
completed exceptionally.
-
completionFuture
default CompletableFuture<?> completionFuture()
Returns aCompletableFuture
which completes when thisRpcResponse
completes.- Specified by:
completionFuture
in interfaceResponse
-
-