T
- the route type that represents the opposite endpoint of a pooled
connection.C
- the connection type.@Contract(threading=SAFE_CONDITIONAL) public abstract class PoolEntry<T,C> extends Object
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).
Modifier and Type | Field and Description |
---|---|
private C |
conn |
private long |
created |
private long |
expiry |
private String |
id |
private T |
route |
private Object |
state |
private long |
updated |
private long |
validityDeadline |
Constructor and Description |
---|
PoolEntry(String id,
T route,
C conn)
Creates new
PoolEntry instance without an expiry deadline. |
PoolEntry(String id,
T route,
C conn,
long timeToLive,
TimeUnit tunit)
Creates new
PoolEntry instance. |
Modifier and Type | Method and Description |
---|---|
abstract void |
close()
Invalidates the pool entry and closes the pooled connection associated
with it.
|
C |
getConnection() |
long |
getCreated() |
long |
getExpiry() |
String |
getId() |
T |
getRoute() |
Object |
getState() |
long |
getUpdated() |
long |
getValidityDeadline() |
long |
getValidUnit()
Deprecated.
|
abstract boolean |
isClosed()
Returns
true if the pool entry has been invalidated. |
boolean |
isExpired(long now) |
void |
setState(Object state) |
String |
toString() |
void |
updateExpiry(long time,
TimeUnit tunit) |
private final long created
private final long validityDeadline
private long updated
private long expiry
public PoolEntry(String id, T route, C conn, long timeToLive, TimeUnit tunit)
PoolEntry
instance.id
- unique identifier of the pool entry. May be null
.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.tunit
- time unit.public C getConnection()
public long getCreated()
public long getValidityDeadline()
@Deprecated public long getValidUnit()
getValidityDeadline()
public long getUpdated()
public long getExpiry()
public void updateExpiry(long time, TimeUnit tunit)
public boolean isExpired(long now)
public abstract void close()
public abstract boolean isClosed()
true
if the pool entry has been invalidated.WebARTS Library Licensed Under the GNU - General Public License. Other Libraries licensed under their respective Open Source Licenses