Package com.redhat.parodos.sdkutils
Class RetryExecutorService<T>
java.lang.Object
com.redhat.parodos.sdkutils.RetryExecutorService<T>
- All Implemented Interfaces:
AutoCloseable
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidclose()submitWithRetry(Callable<T> task) Submit a task to the executor service, retrying on failure until the task succeedssubmitWithRetry(Callable<T> task, long maxRetryTime) 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
-
Field Details
-
RETRY_DELAY
public static final int RETRY_DELAY- See Also:
-
-
Constructor Details
-
RetryExecutorService
public RetryExecutorService()
-
-
Method Details
-
submitWithRetry
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
-
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 submitonSuccess- A callback to invoke when the task succeedsonFailure- A callback to invoke when the task failsmaxRetryTime- The maximum time to retry the task forretryDelay- The delay between retries- Returns:
- The result of the task
-
close
- Specified by:
closein interfaceAutoCloseable- Throws:
Exception
-