Class RetryExecutorService<T>

java.lang.Object
com.redhat.parodos.sdkutils.RetryExecutorService<T>
All Implemented Interfaces:
AutoCloseable

public class RetryExecutorService<T> extends Object implements AutoCloseable
  • Field Details

  • Constructor Details

    • RetryExecutorService

      public RetryExecutorService()
  • Method Details

    • submitWithRetry

      public T submitWithRetry(Callable<T> task)
      Submit a task to the executor service, retrying on failure until the task succeeds
      Parameters:
      task - The task to submit
      Returns:
      The result of the task
    • submitWithRetry

      public T submitWithRetry(Callable<T> task, long maxRetryTime)
    • submitWithRetry

      public T submitWithRetry(Callable<T> task, Runnable onSuccess, Runnable onFailure, long maxRetryTime, long retryDelay)
      Submit a task to the executor service, retrying on failure until the task
      Parameters:
      task - The task to submit
      onSuccess - A callback to invoke when the task succeeds
      onFailure - A callback to invoke when the task fails
      maxRetryTime - The maximum time to retry the task for
      retryDelay - The delay between retries
      Returns:
      The result of the task
    • close

      public void close() throws Exception
      Specified by:
      close in interface AutoCloseable
      Throws:
      Exception