Class HttpIdleConnectionReaper
- java.lang.Object
-
- org.restlet.ext.httpclient.internal.HttpIdleConnectionReaper
-
public class HttpIdleConnectionReaper extends java.lang.ObjectClass that embodies a Reaper thread that reaps idle connections. Note that the thread won't be started if the value of the idleCheckInterval parameter is equal to 0.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description private classHttpIdleConnectionReaper.ReaperThreadThread that reaps idle and expired connections.
-
Field Summary
Fields Modifier and Type Field Description private org.apache.http.client.HttpClienthttpClientThe HttpClient for which this is the reaper.private longidleCheckIntervalThe time to sleep between checks for idle connections.private longidleTimeOutThe age of connections to reap.private HttpIdleConnectionReaper.ReaperThreadreaperThreadThe thread that gleans the idle connections.
-
Constructor Summary
Constructors Constructor Description HttpIdleConnectionReaper(org.apache.http.client.HttpClient httpClient, long idleCheckInterval, long idleTimeout)Constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description booleanisStarted()Returnstrueif the reaper is started.booleanisStopped()Returnstrueif the reaper is stopped.voidstop()Stops the Idle Connection Reaper if running.voidwaitForReaperStart(long millis)Tells the reaper thread the maximum time to wait before starting.voidwaitForReaperStop(long millis)Tells the reaper thread the maximum time to wait before stopping.
-
-
-
Field Detail
-
httpClient
private final org.apache.http.client.HttpClient httpClient
The HttpClient for which this is the reaper.
-
idleCheckInterval
private final long idleCheckInterval
The time to sleep between checks for idle connections.
-
idleTimeOut
private final long idleTimeOut
The age of connections to reap.
-
reaperThread
private final HttpIdleConnectionReaper.ReaperThread reaperThread
The thread that gleans the idle connections.
-
-
Constructor Detail
-
HttpIdleConnectionReaper
public HttpIdleConnectionReaper(org.apache.http.client.HttpClient httpClient, long idleCheckInterval, long idleTimeout)Constructor.- Parameters:
httpClient- The HttpClient for which this is the reaper.idleCheckInterval- The time to sleep between checks for idle connections. Note that if this is 0, then reaping won't occur.idleTimeout- The age of connections to reap.
-
-
Method Detail
-
isStarted
public boolean isStarted()
Returnstrueif the reaper is started.- Returns:
trueIf the reaper is started.
-
isStopped
public boolean isStopped()
Returnstrueif the reaper is stopped.- Returns:
trueif the reaper is stopped.
-
stop
public void stop() throws java.lang.InterruptedExceptionStops the Idle Connection Reaper if running.- Throws:
java.lang.InterruptedException- If the call to stop was interrupted
-
waitForReaperStart
public void waitForReaperStart(long millis) throws java.lang.InterruptedExceptionTells the reaper thread the maximum time to wait before starting.- Parameters:
millis- The maximum time to wait before starting the thread.- Throws:
java.lang.InterruptedException- If the current thread was interrupted.
-
waitForReaperStop
public void waitForReaperStop(long millis) throws java.lang.InterruptedExceptionTells the reaper thread the maximum time to wait before stopping.- Parameters:
millis- The maximum time to wait before stopping the thread.- Throws:
java.lang.InterruptedException- If the current thread was interrupted.
-
-