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
Internal execution APIs.
-
Method Summary
Modifier and TypeMethodDescriptionbooleancancel()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.Returns the most recent execution to be attempted.getLock()Returns a lock object that is common across all execution attempts.Returns the recorded result for an execution attempt.booleanisCancelled(PolicyExecutor<R> policyExecutor) Returns whether the execution is considered cancelled for thepolicyExecutor.booleanReturns whether the execution has been pre-executed, indicating the attempt has started.voidCalled 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.voidRecords 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 Details
-
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
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
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
Returns whether the execution is considered cancelled for thepolicyExecutor. -
getLock
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.
-