ResponseT - response typepublic class DirectRetryingExecutor<ResponseT> extends Object implements RetryingExecutor<ResponseT>
This class is thread-safe.
| Constructor and Description |
|---|
DirectRetryingExecutor(RetryAlgorithm<ResponseT> retryAlgorithm)
Creates a new direct retrying executor instance, which will be using
retryAlgorithm to
determine 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. |
protected void |
sleep(org.threeten.bp.Duration delay)
This method simply calls
Thread.sleep(long). |
com.google.api.core.ApiFuture<ResponseT> |
submit(RetryingFuture<ResponseT> retryingFuture)
Submits an attempt for execution in the current thread, causing the current thread to sleep for
the specified by the
RetryingFuture.getAttemptSettings() amount of time. |
public DirectRetryingExecutor(RetryAlgorithm<ResponseT> retryAlgorithm)
retryAlgorithm to
determine retrying strategy.retryAlgorithm - retry algorithm to use for attempts executionNullPointerException - if retryAlgorithm is nullpublic 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 future is bounded to this executor instance.createFuture in interface RetryingExecutor<ResponseT>callable - the actual callable, which should be executed in a retriable contextpublic com.google.api.core.ApiFuture<ResponseT> submit(RetryingFuture<ResponseT> retryingFuture)
RetryingFuture.getAttemptSettings() amount of time. As result,
this method completes execution only after the specified retryingFuture completes.submit in interface RetryingExecutor<ResponseT>retryingFuture - the future previously returned by createFuture(Callable)retryingFutureprotected void sleep(org.threeten.bp.Duration delay)
throws InterruptedException
Thread.sleep(long).delay - time to sleepInterruptedException - if any thread has interrupted the current thread