@ThreadSafe public class HttpRequestTimer extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
private java.util.concurrent.ScheduledThreadPoolExecutor |
executor |
Constructor and Description |
---|
HttpRequestTimer() |
Modifier and Type | Method and Description |
---|---|
java.util.concurrent.ScheduledThreadPoolExecutor |
getExecutor()
This method is current exposed for testing purposes
|
private void |
initializeExecutor()
Executor is lazily initialized as it's not compatible with Java 6
|
private boolean |
isTimeoutDisabled(int requestTimeoutMillis) |
void |
shutdown()
Shutdown the underlying
ScheduledThreadPoolExecutor . |
HttpRequestAbortTaskTracker |
startTimer(org.apache.http.client.methods.HttpRequestBase apacheRequest,
int requestTimeoutMillis)
Start the timer with the specified timeout and return a object that can be used to track the
state of the timer and cancel it if need be.
|
public HttpRequestAbortTaskTracker startTimer(org.apache.http.client.methods.HttpRequestBase apacheRequest, int requestTimeoutMillis)
apacheRequest
- HTTP request this timer will abort if triggered.requestTimeoutMillis
- A positive value here enables the timer, a non-positive value disables it and
returns a dummy tracker taskHttpRequestAbortTaskTrackerImpl
to query the state of the
task and cancel it if appropriateprivate boolean isTimeoutDisabled(int requestTimeoutMillis)
private void initializeExecutor()
public void shutdown()
ScheduledThreadPoolExecutor
. Should be invoked when
AmazonHttpClient
is shutdownpublic java.util.concurrent.ScheduledThreadPoolExecutor getExecutor()
ScheduledThreadPoolExecutor