Package com.linecorp.armeria.common
Class DefaultRpcResponse
- java.lang.Object
-
- java.util.concurrent.CompletableFuture<Object>
-
- com.linecorp.armeria.common.DefaultRpcResponse
-
- All Implemented Interfaces:
Response
,RpcResponse
,CompletionStage<Object>
,Future<Object>
public class DefaultRpcResponse extends CompletableFuture<Object> implements RpcResponse
DefaultRpcResponse
implementation.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class java.util.concurrent.CompletableFuture
CompletableFuture.AsynchronousCompletionTask
-
-
Constructor Summary
Constructors Constructor Description DefaultRpcResponse()
Creates a new incomplete response.DefaultRpcResponse(Object result)
Creates a new successfully complete response.DefaultRpcResponse(Throwable cause)
Creates a new exceptionally complete response.
-
Method Summary
Modifier and Type Method Description boolean
cancel(boolean mayInterruptIfRunning)
Throwable
cause()
Returns the cause of the failure if thisRpcResponse
completed exceptionally.boolean
completeExceptionally(Throwable cause)
void
obtrudeException(Throwable cause)
String
toString()
-
Methods inherited from class java.util.concurrent.CompletableFuture
acceptEither, acceptEitherAsync, acceptEitherAsync, allOf, anyOf, applyToEither, applyToEitherAsync, applyToEitherAsync, complete, completeAsync, completeAsync, completedFuture, completedStage, completeOnTimeout, copy, defaultExecutor, delayedExecutor, delayedExecutor, exceptionally, exceptionallyAsync, exceptionallyAsync, exceptionallyCompose, exceptionallyComposeAsync, exceptionallyComposeAsync, failedFuture, failedStage, get, get, getNow, getNumberOfDependents, handle, handleAsync, handleAsync, isCancelled, isCompletedExceptionally, isDone, join, minimalCompletionStage, newIncompleteFuture, obtrudeValue, orTimeout, runAfterBoth, runAfterBothAsync, runAfterBothAsync, runAfterEither, runAfterEitherAsync, runAfterEitherAsync, runAsync, runAsync, supplyAsync, supplyAsync, 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 class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface java.util.concurrent.CompletionStage
acceptEither, acceptEitherAsync, acceptEitherAsync, applyToEither, applyToEitherAsync, applyToEitherAsync, exceptionally, exceptionallyAsync, exceptionallyAsync, exceptionallyCompose, exceptionallyComposeAsync, exceptionallyComposeAsync, 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 java.util.concurrent.Future
get, get, isCancelled, isDone
-
Methods inherited from interface com.linecorp.armeria.common.Response
closeFuture
-
Methods inherited from interface com.linecorp.armeria.common.RpcResponse
completionFuture, getNow, isCompletedExceptionally, join
-
-
-
-
Constructor Detail
-
DefaultRpcResponse
public DefaultRpcResponse()
Creates a new incomplete response.
-
DefaultRpcResponse
public DefaultRpcResponse(@Nullable Object result)
Creates a new successfully complete response.- Parameters:
result
- the result or an RPC call
-
DefaultRpcResponse
public DefaultRpcResponse(Throwable cause)
Creates a new exceptionally complete response.- Parameters:
cause
- the cause of failure
-
-
Method Detail
-
cause
@Nullable public final Throwable cause()
Description copied from interface:RpcResponse
Returns the cause of the failure if thisRpcResponse
completed exceptionally.- Specified by:
cause
in interfaceRpcResponse
- Returns:
- the cause, or
null
if thisRpcResponse
completed successfully or did not complete yet.
-
completeExceptionally
public boolean completeExceptionally(Throwable cause)
- Overrides:
completeExceptionally
in classCompletableFuture<Object>
-
obtrudeException
public void obtrudeException(Throwable cause)
- Overrides:
obtrudeException
in classCompletableFuture<Object>
-
cancel
public boolean cancel(boolean mayInterruptIfRunning)
-
toString
public String toString()
- Overrides:
toString
in classCompletableFuture<Object>
-
-