Package dev.failsafe.event
Class ExecutionEvent
- java.lang.Object
-
- dev.failsafe.event.ExecutionEvent
-
- Direct Known Subclasses:
ExecutionAttemptedEvent
,ExecutionCompletedEvent
,ExecutionScheduledEvent
public abstract class ExecutionEvent extends java.lang.Object
Encapsulates information about a Failsafe execution.
-
-
Field Summary
Fields Modifier and Type Field Description private ExecutionContext<?>
context
-
Constructor Summary
Constructors Constructor Description ExecutionEvent(ExecutionContext<?> context)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description int
getAttemptCount()
Gets the number of execution attempts so far, including attempts that are blocked before being executed, such as when aCircuitBreaker
is open.java.time.Duration
getElapsedAttemptTime()
Returns the elapsed time since the last execution attempt began.java.time.Duration
getElapsedTime()
Returns the elapsed time since initial execution began.int
getExecutionCount()
Gets the number of completed executions so far.java.util.Optional<java.time.Instant>
getStartTime()
Returns the time that the initial execution started, elseOptional.empty()
if an execution has not started yet.boolean
isFirstAttempt()
boolean
isRetry()
-
-
-
Field Detail
-
context
private final ExecutionContext<?> context
-
-
Constructor Detail
-
ExecutionEvent
ExecutionEvent(ExecutionContext<?> context)
-
-
Method Detail
-
getElapsedTime
public java.time.Duration getElapsedTime()
Returns the elapsed time since initial execution began.
-
getAttemptCount
public int getAttemptCount()
Gets the number of execution attempts so far, including attempts that are blocked before being executed, such as when aCircuitBreaker
is open. Will return0
when the first attempt is in progress or has yet to begin.
-
getExecutionCount
public int getExecutionCount()
Gets the number of completed executions so far. Executions that are blocked, such as when aCircuitBreaker
is open, are not counted. Will return0
when the first attempt is in progress or has yet to begin.
-
getStartTime
public java.util.Optional<java.time.Instant> getStartTime()
Returns the time that the initial execution started, elseOptional.empty()
if an execution has not started yet.
-
getElapsedAttemptTime
public java.time.Duration getElapsedAttemptTime()
Returns the elapsed time since the last execution attempt began.
-
isFirstAttempt
public boolean isFirstAttempt()
-
isRetry
public boolean isRetry()
-
-