Package dev.failsafe

Class SyncExecutionImpl<R>

java.lang.Object
dev.failsafe.ExecutionImpl<R>
dev.failsafe.SyncExecutionImpl<R>
Type Parameters:
R - result type
All Implemented Interfaces:
Execution<R>, ExecutionContext<R>, ExecutionInternal<R>, SyncExecutionInternal<R>

final class SyncExecutionImpl<R> extends ExecutionImpl<R> implements SyncExecutionInternal<R>
SyncExecution and SyncExecutionInternal implementation.
  • Field Details

  • Constructor Details

  • Method Details

    • complete

      public void complete()
      Description copied from interface: Execution
      Records and completes the execution successfully.
      Specified by:
      complete in interface Execution<R>
    • isComplete

      public boolean isComplete()
      Description copied from interface: Execution
      Returns whether the execution is complete or if it can be retried. An execution is considered complete only when all configured policies consider the execution complete.
      Specified by:
      isComplete in interface Execution<R>
    • getDelay

      public Duration getDelay()
      Description copied from interface: Execution
      Returns the time to delay before the next execution attempt. Returns 0 if an execution has not yet occurred.
      Specified by:
      getDelay in interface Execution<R>
    • record

      public void record(R result, Throwable exception)
      Description copied from interface: Execution
      Records an execution result or exception which triggers failure handling, if needed, by the configured policies. If policy handling is not possible or completed, the execution is completed.
      Specified by:
      record in interface Execution<R>
    • recordResult

      public void recordResult(R result)
      Description copied from interface: Execution
      Records an execution result which triggers failure handling, if needed, by the configured policies. If policy handling is not possible or completed, the execution is completed.
      Specified by:
      recordResult in interface Execution<R>
    • recordException

      public void recordException(Throwable exception)
      Description copied from interface: Execution
      Records an exception which triggers failure handling, if needed, by the configured policies. If policy handling is not possible or completed, the execution is completed.
      Specified by:
      recordException in interface Execution<R>
    • preExecute

      public void preExecute()
      Description copied from interface: ExecutionInternal
      Called when execution of the user's supplier is about to begin.
      Specified by:
      preExecute in interface ExecutionInternal<R>
      Overrides:
      preExecute in class ExecutionImpl<R>
    • postExecute

      ExecutionResult<R> postExecute(ExecutionResult<R> result)
      Description copied from class: ExecutionImpl
      Externally called. Records an execution and performs post-execution handling for the result against all configured policy executors. Returns whether the result is complete for all policies.
      Overrides:
      postExecute in class ExecutionImpl<R>
    • isInterrupted

      public boolean isInterrupted()
      Description copied from interface: SyncExecutionInternal
      Returns whether the execution is currently interrupted.
      Specified by:
      isInterrupted in interface SyncExecutionInternal<R>
    • setInterruptable

      public void setInterruptable(boolean interruptable)
      Description copied from interface: SyncExecutionInternal
      Sets whether the execution is currently interruptable.
      Specified by:
      setInterruptable in interface SyncExecutionInternal<R>
    • interrupt

      public void interrupt()
      Description copied from interface: SyncExecutionInternal
      Interrupts the execution.
      Specified by:
      interrupt in interface SyncExecutionInternal<R>
    • isStandalone

      private boolean isStandalone()
    • copy

      public SyncExecutionImpl<R> copy()
      Description copied from interface: SyncExecutionInternal
      Returns a new copy of the SyncExecutionInternal if it is not standalone, else returns this since standalone executions are referenced externally and cannot be replaced.
      Specified by:
      copy in interface SyncExecutionInternal<R>
    • executeSync

      R executeSync()
      Performs a synchronous execution.