Package dev.failsafe.spi
Interface ExecutionInternal<R>
-
- Type Parameters:
R
- result type
- All Superinterfaces:
ExecutionContext<R>
- All Known Subinterfaces:
AsyncExecutionInternal<R>
,SyncExecutionInternal<R>
- All Known Implementing Classes:
AsyncExecutionImpl
,ExecutionImpl
,SyncExecutionImpl
public interface ExecutionInternal<R> extends ExecutionContext<R>
Internal execution APIs.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description boolean
cancel()
Marks the execution as having been cancelled externally, which will cancel pending executions of all policies.void
cancel(PolicyExecutor<R> policyExecutor)
Marks the execution as having been cancelled by thepolicyExecutor
, which will also cancel pending executions of any inner policies of thepolicyExecutor
.ExecutionInternal<R>
getLatest()
Returns the most recent execution to be attempted.java.lang.Object
getLock()
Returns a lock object that is common across all execution attempts.ExecutionResult<R>
getResult()
Returns the recorded result for an execution attempt.boolean
isCancelled(PolicyExecutor<R> policyExecutor)
Returns whether the execution is considered cancelled for thepolicyExecutor
.boolean
isPreExecuted()
Returns whether the execution has been pre-executed, indicating the attempt has started.void
preExecute()
Called when execution of the user's supplier is about to begin.void
record(ExecutionResult<R> result)
Records theresult
if the execution has beenpre-executed
and a result has not already been recorded.void
recordAttempt()
Records an execution attempt which may correspond with an execution result.-
Methods inherited from interface dev.failsafe.ExecutionContext
getAttemptCount, getElapsedAttemptTime, getElapsedTime, getExecutionCount, getLastException, getLastResult, getLastResult, getStartTime, isCancelled, isFirstAttempt, isRetry, onCancel
-
-
-
-
Method Detail
-
getResult
ExecutionResult<R> getResult()
Returns the recorded result for an execution attempt.
-
preExecute
void preExecute()
Called when execution of the user's supplier is about to begin.
-
isPreExecuted
boolean isPreExecuted()
Returns whether the execution has been pre-executed, indicating the attempt has started.
-
recordAttempt
void recordAttempt()
Records an execution attempt which may correspond with an execution result. Async executions will have results recorded separately.
-
record
void record(ExecutionResult<R> result)
Records theresult
if the execution has beenpre-executed
and a result has not already been recorded.
-
cancel
boolean cancel()
Marks the execution as having been cancelled externally, which will cancel pending executions of all policies.- Returns:
- whether cancellation was successful or not. Returns
false
if the execution was already cancelled or completed.
-
cancel
void cancel(PolicyExecutor<R> policyExecutor)
Marks the execution as having been cancelled by thepolicyExecutor
, which will also cancel pending executions of any inner policies of thepolicyExecutor
. Outer policies of thepolicyExecutor
will be unaffected.
-
isCancelled
boolean isCancelled(PolicyExecutor<R> policyExecutor)
Returns whether the execution is considered cancelled for thepolicyExecutor
.
-
getLock
java.lang.Object getLock()
Returns a lock object that is common across all execution attempts. Useful for guarding against races when mutating an execution.
-
getLatest
ExecutionInternal<R> getLatest()
Returns the most recent execution to be attempted.
-
-