java.lang.Object
net.i2p.client.streaming.impl.ConnectionManager.PooledConnection
- Enclosing class:
ConnectionManager
Wrapper for a pooled connection with metadata.
Field Summary
FieldsModifier and TypeFieldDescription(package private) final ConnectionThe pooled connection.(package private) final AtomicLongWhen the connection was last used.(package private) final longWhen the connection entered the pool.Constructor Summary
ConstructorsMethod Summary
All Methods
Field Details
connection
The pooled connection.pooledAt
final long pooledAtWhen the connection entered the pool.lastUsed
When the connection was last used.
Constructor Details
PooledConnection
PooledConnection(Connection con, long now) Puts one connection in the pool.- Parameters:
con- the connection to poolnow- the current time
Method Details
isStale
boolean isStale(long maxIdleMs, long now) Whether the pooled connection has exceeded max idle time.- Parameters:
maxIdleMs- the most time a connection may sit idle, in millisecondsnow- the current time- Returns:
- true when idle past the maximum
touch
void touch(long now) Update the last-used timestamp.- Parameters:
now- the time to record