Package org.ros.concurrent
Class RetryingExecutorService
java.lang.Object
org.ros.concurrent.RetryingExecutorService
Wraps an
ScheduledExecutorService to execute Callables with
retries.- Author:
- damonkohler@google.com (Damon Kohler)
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidsetRetryDelay(long delay, TimeUnit unit) voidvoidSubmit a newCallableto be executed.
-
Constructor Details
-
RetryingExecutorService
- Parameters:
scheduledExecutorService- theExecutorServiceto wrap
-
-
Method Details
-
submit
Submit a newCallableto be executed. The submittedCallableshould returntrueto be retried,falseotherwise.- Parameters:
callable- theCallableto execute- Throws:
RejectedExecutionException- if theRetryingExecutorServiceis shutting down
-
setRetryDelay
- Parameters:
delay- the delay in units ofunitunit- theTimeUnitof the delay
-
shutdown
Stops accepting newCallables and waits for all submittedCallables to finish within the specified timeout.- Parameters:
timeout- the timeout in units ofunitunit- theTimeUnitoftimeout- Throws:
InterruptedException
-