public class IdleConnectionSweeper extends java.lang.Object implements DestructableComponent
HttpClientConnectionManager.| Modifier and Type | Field and Description |
|---|---|
private org.apache.http.conn.HttpClientConnectionManager |
connectionManager
HttpClientConnectionManager whose connections will be swept.
|
private boolean |
createdTimer
Whether this sweeper created a
TimerTask to use and thus should destroy when destroy() is
invoked. |
private boolean |
destroyed
Whether this sweeper has been destroyed.
|
private java.util.TimerTask |
sweeper
Sweeping task executed by the timer.
|
private java.util.Timer |
taskTimer
Timer used to schedule and execute the sweeping task.
|
| Constructor and Description |
|---|
IdleConnectionSweeper(org.apache.http.conn.HttpClientConnectionManager manager,
long idleTimeout,
long sweepInterval)
Constructor.
|
IdleConnectionSweeper(org.apache.http.conn.HttpClientConnectionManager manager,
long idleTimeout,
long sweepInterval,
java.util.Timer backgroundTimer)
Constructor.
|
| Modifier and Type | Method and Description |
|---|---|
void |
destroy()
Destroys the component.
|
boolean |
isDestroyed()
Gets whether this component has been destroyed.
|
long |
scheduledExecutionTime()
Gets the time, in milliseconds since the epoch, when the sweeper last executed or, if it has not yet executed,
when it was first scheduled to run.
|
private boolean destroyed
private boolean createdTimer
TimerTask to use and thus should destroy when destroy() is
invoked.private final org.apache.http.conn.HttpClientConnectionManager connectionManager
private final java.util.Timer taskTimer
private final java.util.TimerTask sweeper
public IdleConnectionSweeper(@Nonnull
org.apache.http.conn.HttpClientConnectionManager manager,
long idleTimeout,
long sweepInterval)
Timer and use it to periodically sweep connections.manager - HTTP client connection manager whose connections will be sweptidleTimeout - length of time, in milliseconds, connection may be idle before being closed downsweepInterval - length of time, in milliseconds, between sweepspublic IdleConnectionSweeper(@Nonnull
org.apache.http.conn.HttpClientConnectionManager manager,
long idleTimeout,
long sweepInterval,
@Nonnull
java.util.Timer backgroundTimer)
manager - HTTP client connection manager whose connections will be sweptidleTimeout - length of time, in milliseconds, connection may be idle before being closed downsweepInterval - length of time, in milliseconds, between sweepsbackgroundTimer - timer used to schedule the background sweeping taskpublic long scheduledExecutionTime()
public boolean isDestroyed()
isDestroyed in interface DestructableComponentpublic void destroy()
destroy in interface DestructableComponent