public class RemoteRequestRetry<T> extends java.lang.Object implements CustomFuture<T>
| Modifier and Type | Class and Description |
|---|---|
static class |
RemoteRequestRetry.RemoteRequestType
The kind of RemoteRequest that will be created on each retry attempt
|
| Modifier and Type | Field and Description |
|---|---|
protected java.util.Map<java.lang.String,java.lang.Object> |
attachments |
protected Authenticator |
authenticator |
protected java.util.Map<java.lang.String,java.lang.Object> |
body |
protected HttpClientFactory |
clientFactory |
static int |
MAX_RETRIES |
protected java.lang.String |
method |
protected RemoteRequestCompletion |
onCompletionCaller |
protected RemoteRequestCompletion |
onPreCompletionCaller |
protected java.util.concurrent.ExecutorService |
requestExecutor |
protected java.util.Map<java.lang.String,java.lang.Object> |
requestHeaders |
static int |
RETRY_DELAY_MS |
static java.lang.String |
TAG |
protected java.net.URL |
url |
protected java.util.concurrent.ScheduledExecutorService |
workExecutor |
| Constructor and Description |
|---|
RemoteRequestRetry(RemoteRequestRetry.RemoteRequestType requestType,
java.util.concurrent.ScheduledExecutorService requestExecutor,
java.util.concurrent.ScheduledExecutorService workExecutor,
HttpClientFactory clientFactory,
java.lang.String method,
java.net.URL url,
boolean syncGateway,
boolean cancelable,
java.util.Map<java.lang.String,java.lang.Object> body,
java.util.Map<java.lang.String,java.lang.Object> attachments,
Database db,
java.util.Map<java.lang.String,java.lang.Object> requestHeaders,
RemoteRequestCompletion onCompletionCaller) |
| Modifier and Type | Method and Description |
|---|---|
boolean |
cancel(boolean mayInterruptIfRunning) |
T |
get() |
T |
get(long timeout,
java.util.concurrent.TimeUnit unit) |
boolean |
isCancelled() |
boolean |
isDone() |
void |
setAuthenticator(Authenticator authenticator) |
void |
setDontLog404(boolean dontLog404) |
void |
setOnPreCompletionCaller(RemoteRequestCompletion onPreCompletionCaller) |
void |
setQueue(java.util.Queue queue) |
CustomFuture |
submit() |
CustomFuture |
submit(boolean gzip) |
public static final java.lang.String TAG
public static int MAX_RETRIES
public static int RETRY_DELAY_MS
protected java.util.concurrent.ScheduledExecutorService workExecutor
protected java.util.concurrent.ExecutorService requestExecutor
protected final HttpClientFactory clientFactory
protected java.lang.String method
protected java.net.URL url
protected java.util.Map<java.lang.String,java.lang.Object> body
protected java.util.Map<java.lang.String,java.lang.Object> attachments
protected Authenticator authenticator
protected RemoteRequestCompletion onCompletionCaller
protected RemoteRequestCompletion onPreCompletionCaller
protected java.util.Map<java.lang.String,java.lang.Object> requestHeaders
public RemoteRequestRetry(RemoteRequestRetry.RemoteRequestType requestType, java.util.concurrent.ScheduledExecutorService requestExecutor, java.util.concurrent.ScheduledExecutorService workExecutor, HttpClientFactory clientFactory, java.lang.String method, java.net.URL url, boolean syncGateway, boolean cancelable, java.util.Map<java.lang.String,java.lang.Object> body, java.util.Map<java.lang.String,java.lang.Object> attachments, Database db, java.util.Map<java.lang.String,java.lang.Object> requestHeaders, RemoteRequestCompletion onCompletionCaller)
public CustomFuture submit()
public CustomFuture submit(boolean gzip)
gzip - true - send gzipped requestpublic void setAuthenticator(Authenticator authenticator)
public void setOnPreCompletionCaller(RemoteRequestCompletion onPreCompletionCaller)
public void setDontLog404(boolean dontLog404)
public void setQueue(java.util.Queue queue)
setQueue in interface CustomFuture<T>public boolean cancel(boolean mayInterruptIfRunning)
cancel in interface java.util.concurrent.Future<T>public boolean isCancelled()
isCancelled in interface java.util.concurrent.Future<T>public boolean isDone()
isDone in interface java.util.concurrent.Future<T>public T get() throws java.lang.InterruptedException, java.util.concurrent.ExecutionException
get in interface java.util.concurrent.Future<T>java.lang.InterruptedExceptionjava.util.concurrent.ExecutionExceptionpublic T get(long timeout, java.util.concurrent.TimeUnit unit) throws java.lang.InterruptedException, java.util.concurrent.ExecutionException, java.util.concurrent.TimeoutException
get in interface java.util.concurrent.Future<T>java.lang.InterruptedExceptionjava.util.concurrent.ExecutionExceptionjava.util.concurrent.TimeoutException