Package org.apache.http.pool
Class PoolEntry<T,C>
java.lang.Object
org.apache.http.pool.PoolEntry<T,C>
- Type Parameters:
T
- the route type that represents the opposite endpoint of a pooled connection.C
- the connection type.
- Direct Known Subclasses:
BasicNIOPoolEntry
,BasicPoolEntry
Pool entry containing a pool connection object along with its route.
The connection contained by the pool entry may have an expiration time which
can be either set upon construction time or updated with
the updateExpiry(long, TimeUnit)
.
Pool entry may also have an object associated with it that represents a connection state (usually a security principal or a unique token identifying the user whose credentials have been used while establishing the connection).
- Since:
- 4.2
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionabstract void
close()
Invalidates the pool entry and closes the pooled connection associated with it.long
long
getId()
getRoute()
getState()
long
long
long
Deprecated.abstract boolean
isClosed()
Returnstrue
if the pool entry has been invalidated.boolean
isExpired
(long now) void
toString()
void
updateExpiry
(long time, TimeUnit timeUnit)
-
Field Details
-
id
-
route
-
conn
-
created
private final long created -
validityDeadline
private final long validityDeadline -
updated
private long updated -
expiry
private long expiry -
state
-
-
Constructor Details
-
PoolEntry
Creates newPoolEntry
instance.- Parameters:
id
- unique identifier of the pool entry. May benull
.route
- route to the opposite endpoint.conn
- the connection.timeToLive
- maximum time to live. May be zero if the connection does not have an expiry deadline.timeUnit
- time unit.
-
PoolEntry
Creates newPoolEntry
instance without an expiry deadline.- Parameters:
id
- unique identifier of the pool entry. May benull
.route
- route to the opposite endpoint.conn
- the connection.
-
-
Method Details
-
getId
-
getRoute
-
getConnection
-
getCreated
public long getCreated() -
getValidityDeadline
public long getValidityDeadline()- Since:
- 4.4
-
getValidUnit
Deprecated. -
getState
-
setState
-
getUpdated
public long getUpdated() -
getExpiry
public long getExpiry() -
updateExpiry
-
isExpired
public boolean isExpired(long now) -
close
public abstract void close()Invalidates the pool entry and closes the pooled connection associated with it. -
isClosed
public abstract boolean isClosed()Returnstrue
if the pool entry has been invalidated. -
toString
-
getValidityDeadline()