Top Description Fields Constructors Methods
org.eclipse.persistence.sessions.server

public Class ConnectionPool

extends Object
Class Inheritance
Known Direct Subclasses
org.eclipse.persistence.sessions.server.ExternalConnectionPool, org.eclipse.persistence.sessions.server.ReadConnectionPool
Imports
java.util.*, org.eclipse.persistence.internal.databaseaccess.*, org.eclipse.persistence.sessions.Login, org.eclipse.persistence.internal.helper.*, org.eclipse.persistence.exceptions.*, org.eclipse.persistence.internal.localization.*, org.eclipse.persistence.logging.SessionLog

Purpose: Used to specify how connection should be pooled in a server session.

See Also
ServerSession

Field Summary

Modifier and TypeField and Description
protected volatile boolean
protected List<Accessor>
protected List<Accessor>
public static final long
protected volatile long
protected List<String>
public static final int
protected int
protected boolean
protected volatile boolean
protected Login
public static final int
protected int
public static final int
protected int
protected static final String
protected String
protected ServerSession
protected volatile long
public static final int
protected int

Constructor Summary

AccessConstructor and Description
public
ConnectionPool()

PUBLIC: A connection pool is used to specify how connection should be pooled in a server session.

public
ConnectionPool(String name, Login login, ServerSession owner)

PUBLIC: A connection pool is used to specify how connection should be pooled in a server session.

public
ConnectionPool(String name, Login login, int minNumberOfConnections, int maxNumberOfConnections, ServerSession owner)

PUBLIC: A connection pool is used to specify how connection should be pooled in a server session.

public
ConnectionPool(String name, Login login, int initialNumberOfConnections, int minNumberOfConnections, int maxNumberOfConnections, ServerSession owner)

PUBLIC: A connection pool is used to specify how connection should be pooled in a server session.

Method Summary

Modifier and TypeMethod and Description
public synchronized Accessor
acquireConnection()

INTERNAL: Wait until a connection is available and allocate the connection for the client.

public boolean
addFailoverConnectionPool(String poolName)

PUBLIC: Add the connection pool to used if this pool database goes down.

protected Accessor
buildConnection()

INTERNAL: Create a new connection, accessors are used as connections.

public Accessor
failover()

INTERNAL: The connection pool is dead fail over to the fail-over pool.

public List<Accessor>
getConnectionsAvailable()

INTERNAL: returns the connections currently available for use in the pool

protected List<Accessor>

Returns:

java.util.Vector
getConnectionsUsed
()

Return a list of the connections that are being used.

public List<String>
getFailoverConnectionPools()

PUBLIC: Return the list of connection pools to used if this pool database goes down.

public int
getInitialNumberOfConnections()

PUBLIC: Return the initial number of connections allowed.

public Login
getLogin()

PUBLIC: Return the login used to create connections.

public int
getMaxNumberOfConnections()

PUBLIC: Return the maximum number of connections allowed.

public int
getMinNumberOfConnections()

PUBLIC: Return the minimum number of connections.

public String
getName()

PUBLIC: Return the name of this pool.

protected ServerSession

Returns:

org.eclipse.persistence.sessions.server.ServerSession
getOwner
()

Return the ServerSession that is the owner of this connection pool.

public int
getTotalNumberOfConnections()

INTERNAL: Return the total number of connections currently in use.

public int
getWaitTimeout()

PUBLIC: Return the time in milliseconds to wait for a available connection.

public boolean
hasConnectionAvailable()

INTERNAL: Wait until a connection is avaiable and allocate the connection for the client.

public boolean
isConnected()

INTERNAL: Return if this pool has been connected to the database.

public boolean
isDead()

ADVANCED: Return if the connection pool's database is down, and failover should be used.

public boolean
isThereConflictBetweenLoginAndType()

INTERNAL: Checks for a conflict between pool's type and pool's login

public synchronized void
releaseConnection(Accessor connection)

INTERNAL: Add the connection as single that a new connection is available.

public void
resetConnections()

INTERNAL: Reset the connections on shutDown and when the pool is started.

public void
setCheckConnections()

INTERNAL: This method is called to indicate that all available connections should be checked.

protected void
setConnectionsAvailable(Vector<E> connectionsAvailable)

INTERNAL: Set this list of connections available

protected void
setConnectionsUsed(Vector<E> connectionsUsed)

INTERNAL: Set the list of connections being used.

public void
setFailoverConnectionPools(List<String> failoverConnectionPools)

PUBLIC: Set the list of connection pools to used if this pool database goes down.

public void
setInitialNumberOfConnections(int initialNumberOfConnections)

PUBLIC: Set the initial number of connections allowed.

public void
setIsConnected(boolean isConnected)

INTERNAL: Set if this pool has been connected to the database.

public void
setIsDead(boolean isDead)

ADVANCED: Set if the connection pool's database is down, and failover should be used.

public void
setLogin(Login login)

PUBLIC: Set the login used to create connections.

public void
setMaxNumberOfConnections(int maxNumberOfConnections)

PUBLIC: Set the maximum number of connections allowed.

public void
setMinNumberOfConnections(int minNumberOfConnections)

PUBLIC: Set the minimum number of connections.

public void
setName(String name)

PUBLIC: Set the name of this pool.

protected void
setOwner(ServerSession owner)

Set the ServerSession that owns this connection pool

public void
setWaitTimeout(int waitTimeout)

PUBLIC: Set the time in milliseconds to wait for an available connection.

public synchronized void
shutDown()

INTERNAL: Disconnect all connections.

public synchronized void
startUp()

INTERNAL: Allocate the minimum connections.

public String
toString()

Overrides java.lang.Object.toString.

INTERNAL: return a string representation of this connection pool
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAllwaitwaitwait

Field Detail

checkConnectionsback to summary
protected volatile boolean checkConnections
connectionsAvailableback to summary
protected List<Accessor> connectionsAvailable
connectionsUsedback to summary
protected List<Accessor> connectionsUsed
DEAD_CHECK_TIMEback to summary
public static final long DEAD_CHECK_TIME
deadCheckTimeback to summary
protected volatile long deadCheckTime
failoverConnectionPoolsback to summary
protected List<String> failoverConnectionPools
INITIAL_CONNECTIONSback to summary
public static final int INITIAL_CONNECTIONS
initialNumberOfConnectionsback to summary
protected int initialNumberOfConnections
isConnectedback to summary
protected boolean isConnected
isDeadback to summary
protected volatile boolean isDead
loginback to summary
protected Login login
MAX_CONNECTIONSback to summary
public static final int MAX_CONNECTIONS
maxNumberOfConnectionsback to summary
protected int maxNumberOfConnections
MIN_CONNECTIONSback to summary
public static final int MIN_CONNECTIONS
minNumberOfConnectionsback to summary
protected int minNumberOfConnections
MONITOR_HEADERback to summary
protected static final String MONITOR_HEADER
nameback to summary
protected String name
ownerback to summary
protected ServerSession owner
timeOfDeathback to summary
protected volatile long timeOfDeath
WAIT_TIMEOUTback to summary
public static final int WAIT_TIMEOUT
waitTimeoutback to summary
protected int waitTimeout

Constructor Detail

ConnectionPoolback to summary
public ConnectionPool()

PUBLIC: A connection pool is used to specify how connection should be pooled in a server session.

ConnectionPoolback to summary
public ConnectionPool(String name, Login login, ServerSession owner)

PUBLIC: A connection pool is used to specify how connection should be pooled in a server session.

ConnectionPoolback to summary
public ConnectionPool(String name, Login login, int minNumberOfConnections, int maxNumberOfConnections, ServerSession owner)

PUBLIC: A connection pool is used to specify how connection should be pooled in a server session.

ConnectionPoolback to summary
public ConnectionPool(String name, Login login, int initialNumberOfConnections, int minNumberOfConnections, int maxNumberOfConnections, ServerSession owner)

PUBLIC: A connection pool is used to specify how connection should be pooled in a server session.

Method Detail

acquireConnectionback to summary
public synchronized Accessor acquireConnection() throws ConcurrencyException

INTERNAL: Wait until a connection is available and allocate the connection for the client.

addFailoverConnectionPoolback to summary
public boolean addFailoverConnectionPool(String poolName)

PUBLIC: Add the connection pool to used if this pool database goes down. The failover pools should be a clustered, replicated or backuped database.

buildConnectionback to summary
protected Accessor buildConnection()

INTERNAL: Create a new connection, accessors are used as connections.

failoverback to summary
public Accessor failover()

INTERNAL: The connection pool is dead fail over to the fail-over pool.

getConnectionsAvailableback to summary
public List<Accessor> getConnectionsAvailable()

INTERNAL: returns the connections currently available for use in the pool

getConnectionsUsedback to summary
protected List<Accessor> getConnectionsUsed()

Return a list of the connections that are being used.

Returns:List<Accessor>

java.util.Vector

getFailoverConnectionPoolsback to summary
public List<String> getFailoverConnectionPools()

PUBLIC: Return the list of connection pools to used if this pool database goes down. The failover pools should be a clustered, replicated or backuped database.

getInitialNumberOfConnectionsback to summary
public int getInitialNumberOfConnections()

PUBLIC: Return the initial number of connections allowed. This is the number of connections connected on startup.

getLoginback to summary
public Login getLogin()

PUBLIC: Return the login used to create connections.

getMaxNumberOfConnectionsback to summary
public int getMaxNumberOfConnections()

PUBLIC: Return the maximum number of connections allowed. If all connections are in use, a new connection will be created until the maximum size is reach. Only the minimum number of connections will be pooled, if the pool is between the min and max size the connection will be disconnected when returned to the pool. Typically it is desirable to have the min and max connections the same to avoid connects and disconnects. When the max is reached clients must wait for a connection to become available.

getMinNumberOfConnectionsback to summary
public int getMinNumberOfConnections()

PUBLIC: Return the minimum number of connections. If all connections are in use, a new connection will be created until the maximum size is reach. Only the minimum number of connections will be pooled, if the pool is between the min and max size the connection will be disconnected when returned to the pool. Typically it is desirable to have the min and max connections the same to avoid connects and disconnects.

getNameback to summary
public String getName()

PUBLIC: Return the name of this pool. Pools are identified by name to allow multiple connection pools.

getOwnerback to summary
protected ServerSession getOwner()

Return the ServerSession that is the owner of this connection pool.

Returns:ServerSession

org.eclipse.persistence.sessions.server.ServerSession

getTotalNumberOfConnectionsback to summary
public int getTotalNumberOfConnections()

INTERNAL: Return the total number of connections currently in use.

getWaitTimeoutback to summary
public int getWaitTimeout()

PUBLIC: Return the time in milliseconds to wait for a available connection. If the wait time is exceeded and exception will occur. The default is 180000 or 3 minutes. A value of 0 means wait forever.

hasConnectionAvailableback to summary
public boolean hasConnectionAvailable()

INTERNAL: Wait until a connection is avaiable and allocate the connection for the client.

isConnectedback to summary
public boolean isConnected()

INTERNAL: Return if this pool has been connected to the database.

isDeadback to summary
public boolean isDead()

ADVANCED: Return if the connection pool's database is down, and failover should be used.

isThereConflictBetweenLoginAndTypeback to summary
public boolean isThereConflictBetweenLoginAndType()

INTERNAL: Checks for a conflict between pool's type and pool's login

releaseConnectionback to summary
public synchronized void releaseConnection(Accessor connection) throws DatabaseException

INTERNAL: Add the connection as single that a new connection is available.

resetConnectionsback to summary
public void resetConnections()

INTERNAL: Reset the connections on shutDown and when the pool is started.

setCheckConnectionsback to summary
public void setCheckConnections()

INTERNAL: This method is called to indicate that all available connections should be checked.

setConnectionsAvailableback to summary
protected void setConnectionsAvailable(Vector<E> connectionsAvailable)

INTERNAL: Set this list of connections available

setConnectionsUsedback to summary
protected void setConnectionsUsed(Vector<E> connectionsUsed)

INTERNAL: Set the list of connections being used.

setFailoverConnectionPoolsback to summary
public void setFailoverConnectionPools(List<String> failoverConnectionPools)

PUBLIC: Set the list of connection pools to used if this pool database goes down. The failover pools should be a clustered, replicated or backuped database.

setInitialNumberOfConnectionsback to summary
public void setInitialNumberOfConnections(int initialNumberOfConnections)

PUBLIC: Set the initial number of connections allowed. This is the number of connections connected on startup. The default is 1.

setIsConnectedback to summary
public void setIsConnected(boolean isConnected)

INTERNAL: Set if this pool has been connected to the database.

setIsDeadback to summary
public void setIsDead(boolean isDead)

ADVANCED: Set if the connection pool's database is down, and failover should be used.

setLoginback to summary
public void setLogin(Login login)

PUBLIC: Set the login used to create connections.

setMaxNumberOfConnectionsback to summary
public void setMaxNumberOfConnections(int maxNumberOfConnections)

PUBLIC: Set the maximum number of connections allowed. If all connections are in use, a new connection will be created until the maximum size is reach. Only the minimum number of connections will be pooled, if the pool is between the min and max size the connection will be disconnected when returned to the pool. Typically it is desirable to have the min and max connections the same to avoid connects and disconnects. When the max is reached clients must wait for a connection to become available. The default is 32.

setMinNumberOfConnectionsback to summary
public void setMinNumberOfConnections(int minNumberOfConnections)

PUBLIC: Set the minimum number of connections. If all connections are in use, a new connection will be created until the maximum size is reach. Only the minimum number of connections will be pooled, if the pool is between the min and max size the connection will be disconnected when returned to the pool. Typically it is desirable to have the min and max connections the same to avoid connects and disconnects. The default is 32.

setNameback to summary
public void setName(String name)

PUBLIC: Set the name of this pool. Pools are identified by name to allow multiple connection pools.

setOwnerback to summary
protected void setOwner(ServerSession owner)

Set the ServerSession that owns this connection pool

setWaitTimeoutback to summary
public void setWaitTimeout(int waitTimeout)

PUBLIC: Set the time in milliseconds to wait for an available connection. If the wait time is exceeded an exception will occur. The default is 180000 or 3 minutes. A value of 0 means wait forever.

shutDownback to summary
public synchronized void shutDown()

INTERNAL: Disconnect all connections.

startUpback to summary
public synchronized void startUp()

INTERNAL: Allocate the minimum connections.

toStringback to summary
public String toString()

Overrides java.lang.Object.toString.

INTERNAL: return a string representation of this connection pool

Returns:String

Doc from java.lang.Object.toString.

a string representation of the object.

Annotations
@Override