T
- the route type that represents the opposite endpoint of a pooled
connection.C
- the connection type.public final class PoolEntry<T,C extends ModalCloseable> extends Object
The connection assigned to this pool entry may have an expiration time and also have an object representing a connection state (usually a security principal or a unique token identifying the user whose credentials have been used while establishing the connection).
Constructor and Description |
---|
PoolEntry(T route) |
PoolEntry(T route,
TimeValue timeToLive)
Creates new
PoolEntry instance. |
PoolEntry(T route,
TimeValue timeToLive,
DisposalCallback<C> disposalCallback)
Creates new
PoolEntry instance. |
Modifier and Type | Method and Description |
---|---|
void |
assignConnection(C conn) |
void |
discardConnection(CloseMode closeMode) |
C |
getConnection() |
Deadline |
getExpiryDeadline() |
T |
getRoute() |
Object |
getState() |
long |
getUpdated() |
Deadline |
getValidityDeadline() |
boolean |
hasConnection() |
String |
toString()
Returns a string representation of the object.
|
void |
updateExpiry(TimeValue expiryTime) |
void |
updateState(Object state) |
public PoolEntry(T route)
public PoolEntry(T route, TimeValue timeToLive)
PoolEntry
instance.route
- route to the opposite endpoint.timeToLive
- maximum time to live. May be zero if the connection
does not have an expiry deadline.public PoolEntry(T route, TimeValue timeToLive, DisposalCallback<C> disposalCallback)
PoolEntry
instance.route
- route to the opposite endpoint.timeToLive
- maximum time to live. May be zero if the connection
does not have an expiry deadline.disposalCallback
- callback invoked before connection disposal.public void assignConnection(C conn)
public void discardConnection(CloseMode closeMode)
public C getConnection()
public Deadline getExpiryDeadline()
public T getRoute()
public Object getState()
public long getUpdated()
public Deadline getValidityDeadline()
public boolean hasConnection()
public String toString()
Object
toString
method returns a
string that "textually represents" this object. The result should be a concise but informative
representation that is easy for a person to read. It is recommended that all subclasses override
this method.
The toString
method for class Object
returns a string consisting of the name of
the class of which the object is an instance, the at-sign character `@
', and the unsigned
hexadecimal representation of the hash code of the object. In other words, this method returns a
string equal to the value of:
getClass().getName() + '@' + Integer.toHexString(hashCode())
public void updateExpiry(TimeValue expiryTime)
public void updateState(Object state)