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 booleancancel()Marks the execution as having been cancelled externally, which will cancel pending executions of all policies.voidcancel(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.ObjectgetLock()Returns a lock object that is common across all execution attempts.ExecutionResult<R>getResult()Returns the recorded result for an execution attempt.booleanisCancelled(PolicyExecutor<R> policyExecutor)Returns whether the execution is considered cancelled for thepolicyExecutor.booleanisPreExecuted()Returns whether the execution has been pre-executed, indicating the attempt has started.voidpreExecute()Called when execution of the user's supplier is about to begin.voidrecord(ExecutionResult<R> result)Records theresultif the execution has beenpre-executedand a result has not already been recorded.voidrecordAttempt()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 theresultif the execution has beenpre-executedand 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
falseif 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 thepolicyExecutorwill 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.
-
-