APIdia Launch Partner
Top Description Fields Constructors Methods
com.sun.jndi.ldap.pool

pack-priv final Class ConnectionDesc

extends Object
Class Inheritance
Imports
java.util.concurrent.locks.ReentrantLock

Represents a description of PooledConnection in Connections. Contains a PooledConnection, its state (busy, idle, expired), and idle time. Any access or update to a descriptor's state is synchronized.
Author
Rosanna Lee

Field Summary

Modifier and TypeField and Description
pack-priv static final byte
private final PooledConnection
private static final boolean
pack-priv static final byte
pack-priv static final byte
private long
private final ReentrantLock
private byte
private long

Constructor Summary

AccessConstructor and Description
pack-priv
pack-priv
ConnectionDesc(PooledConnection conn, boolean use)

Method Summary

Modifier and TypeMethod and Description
private void
d(String msg)

public boolean
equals(Object obj)

Overrides java.lang.Object.equals.

Two desc are equal if their PooledConnections are the same.

pack-priv boolean

Returns:

true if entry is idle and has expired; false otherwise.
expire
(long
a connection that has been idle before this time have expired.
threshold
)

If ConnectionDesc is IDLE and has expired, close the corresponding PooledConnection.

pack-priv int
pack-priv long
public int
hashCode()

Overrides java.lang.Object.hashCode.

Hashcode is that of PooledConnection to facilitate searching for a ConnectionDesc using only its PooledConnection.

pack-priv boolean

Returns:

true if state change occurred.
release
()

Changes the state of a ConnectionDesc from BUSY to IDLE and records the current time so that we will know how long it has been idle.

public String
toString()

Overrides java.lang.Object.toString.

Returns a string representation of the object.

pack-priv PooledConnection

Returns:

ConnectionDesc's PooledConnection if it was idle; null otherwise.
tryUse
()

If ConnectionDesc is IDLE, change its state to BUSY and return its connection.

Inherited from java.lang.Object:
clonefinalizegetClassnotifynotifyAllwaitwaitwait

Field Detail

BUSYback to summary
pack-priv static final byte BUSY
connback to summary
private final PooledConnection conn
debugback to summary
private static final boolean debug
EXPIREDback to summary
pack-priv static final byte EXPIRED
IDLEback to summary
pack-priv static final byte IDLE
idleSinceback to summary
private long idleSince
lockback to summary
private final ReentrantLock lock
stateback to summary
private byte state
useCountback to summary
private long useCount

Constructor Detail

ConnectionDescback to summary
pack-priv ConnectionDesc(PooledConnection conn)
ConnectionDescback to summary
pack-priv ConnectionDesc(PooledConnection conn, boolean use)

Method Detail

dback to summary
private void d(String msg)
equalsback to summary
public boolean equals(Object obj)

Overrides java.lang.Object.equals.

Two desc are equal if their PooledConnections are the same. This is useful when searching for a ConnectionDesc using only its PooledConnection.

expireback to summary
pack-priv boolean expire(long threshold)

If ConnectionDesc is IDLE and has expired, close the corresponding PooledConnection.

Parameters
threshold:long

a connection that has been idle before this time have expired.

Returns:boolean

true if entry is idle and has expired; false otherwise.

getStateback to summary
pack-priv int getState()
getUseCountback to summary
pack-priv long getUseCount()
hashCodeback to summary
public int hashCode()

Overrides java.lang.Object.hashCode.

Hashcode is that of PooledConnection to facilitate searching for a ConnectionDesc using only its PooledConnection.

releaseback to summary
pack-priv boolean release()

Changes the state of a ConnectionDesc from BUSY to IDLE and records the current time so that we will know how long it has been idle.

Returns:boolean

true if state change occurred.

toStringback to summary
public String toString()

Overrides java.lang.Object.toString.

Doc from java.lang.Object.toString.

Returns a string representation of the object. Satisfying this method's contract implies a non-null result must be returned.

tryUseback to summary
pack-priv PooledConnection tryUse()

If ConnectionDesc is IDLE, change its state to BUSY and return its connection.

Returns:PooledConnection

ConnectionDesc's PooledConnection if it was idle; null otherwise.