Top Description Fields Constructors Methods
org.apache.http.pool

public abstract Class PoolEntry<T, C>

extends Object
Class Inheritance
Known Direct Subclasses
org.apache.http.impl.pool.BasicPoolEntry
Annotations
@Contract
threading:SAFE_CONDITIONAL
Type Parameters
<T>
the route type that represents the opposite endpoint of a pooled connection.
<C>
the connection type.
Imports
org.apache.http.annotation.Contract, .ThreadingBehavior, org.apache.http.util.Args, java.util.concurrent.TimeUnit

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

Modifier and TypeField and Description
private final C
private final long
private long
private final String
private final T
private volatile Object
private long
private final long

Constructor Summary

AccessConstructor and Description
public
PoolEntry(final String
unique identifier of the pool entry. May be null.
id
,
final T
route to the opposite endpoint.
route
,
final C
the connection.
conn
,
final long
maximum time to live. May be zero if the connection does not have an expiry deadline.
timeToLive
,
final TimeUnit
time unit.
timeUnit
)

Creates new PoolEntry instance.

public
PoolEntry(final String
unique identifier of the pool entry. May be null.
id
,
final T
route to the opposite endpoint.
route
,
final C
the connection.
conn
)

Creates new PoolEntry instance without an expiry deadline.

Method Summary

Modifier and TypeMethod and Description
public abstract void
close()

Invalidates the pool entry and closes the pooled connection associated with it.

public C
public long
public synchronized long
public String
public T
public Object
public synchronized long
public long
public long
public abstract boolean
isClosed()

Returns true if the pool entry has been invalidated.

public synchronized boolean
isExpired(final long now)

public void
setState(final Object state)

public String
toString()

Overrides java.lang.Object.toString.

Returns a string representation of the object.
public synchronized void
updateExpiry(final long time, final TimeUnit timeUnit)

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAllwaitwaitwait

Field Detail

connback to summary
private final C conn
createdback to summary
private final long created
expiryback to summary
private long expiry
idback to summary
private final String id
routeback to summary
private final T route
stateback to summary
private volatile Object state
updatedback to summary
private long updated
validityDeadlineback to summary
private final long validityDeadline

Constructor Detail

PoolEntryback to summary
public PoolEntry(final String id, final T route, final C conn, final long timeToLive, final TimeUnit timeUnit)

Creates new PoolEntry instance.

Parameters
id:String

unique identifier of the pool entry. May be null.

route:T

route to the opposite endpoint.

conn:C

the connection.

timeToLive:long

maximum time to live. May be zero if the connection does not have an expiry deadline.

timeUnit:TimeUnit

time unit.

PoolEntryback to summary
public PoolEntry(final String id, final T route, final C conn)

Creates new PoolEntry instance without an expiry deadline.

Parameters
id:String

unique identifier of the pool entry. May be null.

route:T

route to the opposite endpoint.

conn:C

the connection.

Method Detail

closeback to summary
public abstract void close()

Invalidates the pool entry and closes the pooled connection associated with it.

getConnectionback to summary
public C getConnection()
getCreatedback to summary
public long getCreated()
getExpiryback to summary
public synchronized long getExpiry()
getIdback to summary
public String getId()
getRouteback to summary
public T getRoute()
getStateback to summary
public Object getState()
getUpdatedback to summary
public synchronized long getUpdated()
getValidityDeadlineback to summary
public long getValidityDeadline()
Since
4.4
getValidUnitback to summary
public long getValidUnit()

Deprecated

use getValidityDeadline()

Annotations
@Deprecated
isClosedback to summary
public abstract boolean isClosed()

Returns true if the pool entry has been invalidated.

isExpiredback to summary
public synchronized boolean isExpired(final long now)
setStateback to summary
public void setState(final Object state)
toStringback to summary
public String toString()

Overrides java.lang.Object.toString.

Doc from java.lang.Object.toString.

Returns a string representation of the object.

Returns:String

a string representation of the object.

Annotations
@Override
updateExpiryback to summary
public synchronized void updateExpiry(final long time, final TimeUnit timeUnit)