Class ExecutionResult<R>
java.lang.Object
dev.failsafe.spi.ExecutionResult<R>
- Type Parameters:
R- result type
This class represents the internal result of an execution attempt for zero or more policies, before or after the
policy has handled the result. If a policy is done handling a result or is no longer able to handle a result, such as
when retries are exceeded, the ExecutionResult should be marked as complete.
This class is immutable.
- Author:
- Jonathan Halterman
-
Constructor Summary
ConstructorsConstructorDescriptionExecutionResult(R result, Throwable exception) Records an initial execution result withcompletetrue andsuccessset to true ifexceptionis not null. -
Method Summary
Modifier and TypeMethodDescriptionbooleanstatic <R> ExecutionResult<R> Returns an ExecutionResult with theexceptionset,completetrue andsuccessfalse.longgetDelay()booleanReturns whether the execution was successful for all policies.inthashCode()booleanbooleanbooleanstatic <R> ExecutionResult<R> none()Returns an execution that was completed with a non-result.static <R> CompletableFuture<ExecutionResult<R>> Returns a CompletableFuture that is completed withnull.static <R> ExecutionResult<R> success(R result) Returns an ExecutionResult with theresultset,completetrue andsuccesstrue.toString()with(long delayNanos, boolean complete, boolean success) Returns a copy of the ExecutionResult with thedelayNanos,completeandsuccessvalues.withDelay(long delayNanos) Returns a copy of the ExecutionResult with thedelayNanosvalue.Returns a copy of the ExecutionResult with success value of {code false}.Returns a copy of the ExecutionResult with a non-result, and complete and success set to true.Returns a copy of the ExecutionResult withcompleteset to false, else this if nothing has changed.withResult(R result) Returns a copy of the ExecutionResult with theresultvalue, and complete and success set to true.Returns a copy of the ExecutionResult with thecompleteandsuccessvalues oftrue.
-
Constructor Details
-
ExecutionResult
-
-
Method Details
-
nullFuture
Returns a CompletableFuture that is completed withnull. Uses an intern'ed value to avoid new object creation. -
success
Returns an ExecutionResult with theresultset,completetrue andsuccesstrue. -
exception
Returns an ExecutionResult with theexceptionset,completetrue andsuccessfalse. -
none
Returns an execution that was completed with a non-result. Uses an intern'ed value to avoid new object creation. -
getResult
-
getException
-
getDelay
public long getDelay() -
isComplete
public boolean isComplete() -
isNonResult
public boolean isNonResult() -
isSuccess
public boolean isSuccess() -
withNonResult
Returns a copy of the ExecutionResult with a non-result, and complete and success set to true. Returnsthisifsuccessandresultare unchanged. -
withResult
Returns a copy of the ExecutionResult with theresultvalue, and complete and success set to true. Returnsthisifsuccessandresultare unchanged. -
withNotComplete
Returns a copy of the ExecutionResult withcompleteset to false, else this if nothing has changed. -
withException
Returns a copy of the ExecutionResult with success value of {code false}. -
withSuccess
Returns a copy of the ExecutionResult with thecompleteandsuccessvalues oftrue. -
withDelay
Returns a copy of the ExecutionResult with thedelayNanosvalue. -
with
Returns a copy of the ExecutionResult with thedelayNanos,completeandsuccessvalues. -
getSuccessAll
public boolean getSuccessAll()Returns whether the execution was successful for all policies. -
toString
-
equals
-
hashCode
-