Class ExecutionEvent

java.lang.Object
dev.failsafe.event.ExecutionEvent
Direct Known Subclasses:
ExecutionAttemptedEvent, ExecutionCompletedEvent, ExecutionScheduledEvent

public abstract class ExecutionEvent extends Object
Encapsulates information about a Failsafe execution.
  • Field Details

  • Constructor Details

  • Method Details

    • getElapsedTime

      public 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 a CircuitBreaker is open. Will return 0 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 a CircuitBreaker is open, are not counted. Will return 0 when the first attempt is in progress or has yet to begin.
    • getStartTime

      public Optional<Instant> getStartTime()
      Returns the time that the initial execution started, else Optional.empty() if an execution has not started yet.
    • getElapsedAttemptTime

      public Duration getElapsedAttemptTime()
      Returns the elapsed time since the last execution attempt began.
    • isFirstAttempt

      public boolean isFirstAttempt()
      Returns true when getAttemptCount() is 0 meaning this is the first execution attempt.
    • isRetry

      public boolean isRetry()
      Returns true when getAttemptCount() is > 0 meaning the execution is being retried.