ResponseT - response type@BetaApi public class ScheduledRetryingExecutor<ResponseT> extends Object implements RetryingExecutor<ResponseT>
ScheduledExecutorService to schedule an attempt tasks.
This class is thread-safe.
| Constructor and Description |
|---|
ScheduledRetryingExecutor(RetryAlgorithm retryAlgorithm,
ScheduledExecutorService scheduler)
Creates a new scheduled retry executor, which will be using
scheduler for actual
attempts scheduling and retryAlgorithm for retrying strategy. |
| Modifier and Type | Method and Description |
|---|---|
RetryingFuture<ResponseT> |
createFuture(Callable<ResponseT> callable)
Creates a
RetryingFuture, which is a facade, returned to the client code to wait for
any retriable operation to complete. |
void |
submit(RetryingFuture<ResponseT> retryingFuture)
Submits an attempt for execution in a different thread.
|
public ScheduledRetryingExecutor(RetryAlgorithm retryAlgorithm, ScheduledExecutorService scheduler)
scheduler for actual
attempts scheduling and retryAlgorithm for retrying strategy.retryAlgorithm - retry algorithm to usescheduler - schedulerpublic RetryingFuture<ResponseT> createFuture(Callable<ResponseT> callable)
RetryingFuture, which is a facade, returned to the client code to wait for
any retriable operation to complete. The returned future is bounded to this executor
instance.createFuture in interface RetryingExecutor<ResponseT>callable - the actual callable, which should be executed in a retriable contextpublic void submit(RetryingFuture<ResponseT> retryingFuture)
submit in interface RetryingExecutor<ResponseT>retryingFuture - the future previously returned by createFuture(Callable)