Class HttpRequestTimer
- java.lang.Object
-
- com.amazonaws.http.timers.request.HttpRequestTimer
-
@ThreadSafe public class HttpRequestTimer extends Object
Represents a timer class to enforce HTTP request timeouts.
-
-
Constructor Summary
Constructors Constructor Description HttpRequestTimer()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description ScheduledThreadPoolExecutor
getExecutor()
This method is current exposed for testing purposesvoid
shutdown()
Shutdown the underlyingScheduledThreadPoolExecutor
.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.
-
-
-
Method Detail
-
startTimer
public 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.- Parameters:
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 task- Returns:
- Implementation of
HttpRequestAbortTaskTrackerImpl
to query the state of the task and cancel it if appropriate
-
shutdown
public void shutdown()
Shutdown the underlyingScheduledThreadPoolExecutor
. Should be invoked whenAmazonHttpClient
is shutdown
-
getExecutor
public ScheduledThreadPoolExecutor getExecutor()
This method is current exposed for testing purposes- Returns:
- The underlying
ScheduledThreadPoolExecutor
-
-