Package dev.failsafe.spi
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.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final booleanWhether a policy has completed handling of the executionprivate final longThe amount of time to wait prior to the next execution, according to the policyprivate final ThrowableThe execution exception, if anyprivate static final ExecutionResult<?> private final booleanWhether the result represents a non result rather than anullresultprivate static final CompletableFuture<?> private final RThe execution result, if anyprivate final booleanWhether a policy determined the execution to be a successprivate final BooleanWhether all policies determined the execution to be a success -
Constructor Summary
ConstructorsModifierConstructorDescriptionExecutionResult(R result, Throwable exception) Records an initial execution result withcompletetrue andsuccessset to true ifexceptionis not null.privateExecutionResult(R result, Throwable exception, boolean nonResult, long delayNanos, boolean complete, boolean success, Boolean successAll) -
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.
-
Field Details
-
NULL_FUTURE
-
NONE
-
result
The execution result, if any -
exception
The execution exception, if any -
nonResult
private final boolean nonResultWhether the result represents a non result rather than anullresult -
delayNanos
private final long delayNanosThe amount of time to wait prior to the next execution, according to the policy -
complete
private final boolean completeWhether a policy has completed handling of the execution -
success
private final boolean successWhether a policy determined the execution to be a success -
successAll
Whether all policies determined the execution to be a success
-
-
Constructor Details
-
ExecutionResult
Records an initial execution result withcompletetrue andsuccessset to true ifexceptionis not null. -
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
-
withResult
-
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
public int hashCode()
-