Class LinearRetry<T>

java.lang.Object
com.oracle.cloud.baremetal.jenkins.retry.LinearRetry<T>
All Implemented Interfaces:
Retry<T>

public class LinearRetry<T> extends Object implements Retry<T>
  • Constructor Details

    • LinearRetry

      public LinearRetry(Callable<T> task)
    • LinearRetry

      public LinearRetry(Callable<T> task, int maxRetries)
    • LinearRetry

      public LinearRetry(Callable<T> task, int maxRetries, Duration retryDelay, Duration retryTimeout)
      Parameters:
      task - Callable that throws exception on error
      maxRetries - Positive number of attempts to call task before raising exception
      retryDelay - Time between attempts
      retryTimeout - Maximum task execution time after which it is considered failed
  • Method Details

    • canRetry

      public boolean canRetry()
      Description copied from interface: Retry
      Check that another retry can be attempted.
      Specified by:
      canRetry in interface Retry<T>
      Returns:
      true, if another retry is possible
      See Also:
    • run

      public T run() throws Exception
      Description copied from interface: Retry
      Start attempting to run provided task.
      Specified by:
      run in interface Retry<T>
      Returns:
      task's return value
      Throws:
      Exception - on task failure TimeoutException on task timeout
      See Also: