R
- result typepublic final class ExecutionResult<R> extends Object
This class is immutable.
Constructor and Description |
---|
ExecutionResult(R result,
Throwable exception)
Records an initial execution result with
complete true and success set to true if exception
is not null. |
Modifier and Type | Method and Description |
---|---|
boolean |
equals(Object o) |
static <R> ExecutionResult<R> |
exception(Throwable exception)
Returns an ExecutionResult with the
exception set, complete true and success false. |
long |
getDelay() |
Throwable |
getException() |
R |
getResult() |
boolean |
getSuccessAll()
Returns whether the execution was successful for all policies.
|
int |
hashCode() |
boolean |
isComplete() |
boolean |
isNonResult() |
boolean |
isSuccess() |
static <R> ExecutionResult<R> |
none()
Returns an execution that was completed with a non-result.
|
static <R> CompletableFuture<ExecutionResult<R>> |
nullFuture()
Returns a CompletableFuture that is completed with
null . |
static <R> ExecutionResult<R> |
success(R result)
Returns an ExecutionResult with the
result set, complete true and success true. |
String |
toString() |
ExecutionResult<R> |
with(long delayNanos,
boolean complete,
boolean success)
Returns a copy of the ExecutionResult with the
delayNanos , complete and success values. |
ExecutionResult<R> |
withDelay(long delayNanos)
Returns a copy of the ExecutionResult with the
delayNanos value. |
ExecutionResult<R> |
withException()
Returns a copy of the ExecutionResult with success value of {code false}.
|
ExecutionResult<R> |
withNonResult()
Returns a copy of the ExecutionResult with a non-result, and complete and success set to true.
|
ExecutionResult<R> |
withNotComplete()
Returns a copy of the ExecutionResult with
complete set to false, else this if nothing has changed. |
ExecutionResult<R> |
withResult(R result)
Returns a copy of the ExecutionResult with the
result value, and complete and success set to true. |
ExecutionResult<R> |
withSuccess()
Returns a copy of the ExecutionResult with the
complete and success values of true . |
public static <R> CompletableFuture<ExecutionResult<R>> nullFuture()
null
. Uses an intern'ed value to avoid new object
creation.public static <R> ExecutionResult<R> success(R result)
result
set, complete
true and success
true.public static <R> ExecutionResult<R> exception(Throwable exception)
exception
set, complete
true and success
false.public static <R> ExecutionResult<R> none()
public R getResult()
public Throwable getException()
public long getDelay()
public boolean isComplete()
public boolean isNonResult()
public boolean isSuccess()
public ExecutionResult<R> withNonResult()
public ExecutionResult<R> withResult(R result)
public ExecutionResult<R> withNotComplete()
complete
set to false, else this if nothing has changed.public ExecutionResult<R> withException()
public ExecutionResult<R> withSuccess()
complete
and success
values of true
.public ExecutionResult<R> withDelay(long delayNanos)
delayNanos
value.public ExecutionResult<R> with(long delayNanos, boolean complete, boolean success)
delayNanos
, complete
and success
values.public boolean getSuccessAll()
Copyright © 2022. All rights reserved.