public class IdleConnectionSweeper extends 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
|
private boolean |
destroyed
Whether this sweeper has been destroyed.
|
private TimerTask |
sweeper
Sweeping task executed by the timer.
|
private 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,
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
private final org.apache.http.conn.HttpClientConnectionManager connectionManager
private final Timer taskTimer
private final 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 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 DestructableComponent
public void destroy()
destroy
in interface DestructableComponent
Copyright © 1999–2017. All rights reserved.