Class ConnectionPool
java.lang.Object
org.eclipse.persistence.sessions.server.ConnectionPool
- Direct Known Subclasses:
 ExternalConnectionPool,ReadConnectionPool
Purpose: Used to specify how connection should be pooled in a server session.
- See Also:
 
- 
Field Summary
FieldsModifier and TypeFieldDescriptionprotected booleanprotected List<org.eclipse.persistence.internal.databaseaccess.Accessor>protected List<org.eclipse.persistence.internal.databaseaccess.Accessor>static final longprotected longstatic final intprotected intprotected booleanprotected booleanprotected Loginstatic final intprotected intstatic final intprotected intprotected static final Stringprotected Stringprotected ServerSessionprotected longstatic final intprotected int - 
Constructor Summary
ConstructorsConstructorDescriptionPUBLIC: A connection pool is used to specify how connection should be pooled in a server session.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.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.ConnectionPool(String name, Login login, ServerSession owner) PUBLIC: A connection pool is used to specify how connection should be pooled in a server session. - 
Method Summary
Modifier and TypeMethodDescriptionorg.eclipse.persistence.internal.databaseaccess.AccessorINTERNAL: Wait until a connection is available and allocate the connection for the client.booleanaddFailoverConnectionPool(String poolName) PUBLIC: Add the connection pool to used if this pool database goes down.protected org.eclipse.persistence.internal.databaseaccess.AccessorINTERNAL: Create a new connection, accessors are used as connections.org.eclipse.persistence.internal.databaseaccess.Accessorfailover()INTERNAL: The connection pool is dead fail over to the fail-over pool.List<org.eclipse.persistence.internal.databaseaccess.Accessor>INTERNAL: returns the connections currently available for use in the poolprotected List<org.eclipse.persistence.internal.databaseaccess.Accessor>Return a list of the connections that are being used.PUBLIC: Return the list of connection pools to used if this pool database goes down.intPUBLIC: Return the initial number of connections allowed.getLogin()PUBLIC: Return the login used to create connections.intPUBLIC: Return the maximum number of connections allowed.intPUBLIC: Return the minimum number of connections.getName()PUBLIC: Return the name of this pool.protected ServerSessiongetOwner()Return the ServerSession that is the owner of this connection pool.intINTERNAL: Return the total number of connections currently in use.intPUBLIC: Return the time in milliseconds to wait for a available connection.booleanINTERNAL: Wait until a connection is avaiable and allocate the connection for the client.booleanINTERNAL: Return if this pool has been connected to the database.booleanisDead()ADVANCED: Return if the connection pool's database is down, and failover should be used.booleanINTERNAL: Checks for a conflict between pool's type and pool's loginvoidreleaseConnection(org.eclipse.persistence.internal.databaseaccess.Accessor connection) INTERNAL: Add the connection as single that a new connection is available.voidINTERNAL: Reset the connections on shutDown and when the pool is started.voidINTERNAL: This method is called to indicate that all available connections should be checked.protected voidsetConnectionsAvailable(Vector connectionsAvailable) INTERNAL: Set this list of connections availableprotected voidsetConnectionsUsed(Vector connectionsUsed) INTERNAL: Set the list of connections being used.voidsetFailoverConnectionPools(List<String> failoverConnectionPools) PUBLIC: Set the list of connection pools to used if this pool database goes down.voidsetInitialNumberOfConnections(int initialNumberOfConnections) PUBLIC: Set the initial number of connections allowed.voidsetIsConnected(boolean isConnected) INTERNAL: Set if this pool has been connected to the database.voidsetIsDead(boolean isDead) ADVANCED: Set if the connection pool's database is down, and failover should be used.voidPUBLIC: Set the login used to create connections.voidsetMaxNumberOfConnections(int maxNumberOfConnections) PUBLIC: Set the maximum number of connections allowed.voidsetMinNumberOfConnections(int minNumberOfConnections) PUBLIC: Set the minimum number of connections.voidPUBLIC: Set the name of this pool.protected voidsetOwner(ServerSession owner) Set the ServerSession that owns this connection poolvoidsetWaitTimeout(int waitTimeout) PUBLIC: Set the time in milliseconds to wait for an available connection.voidshutDown()INTERNAL: Disconnect all connections.voidstartUp()INTERNAL: Allocate the minimum connections.toString()INTERNAL: return a string representation of this connection pool 
- 
Field Details
- 
MONITOR_HEADER
- See Also:
 
 - 
isConnected
protected boolean isConnected - 
maxNumberOfConnections
protected int maxNumberOfConnections - 
minNumberOfConnections
protected int minNumberOfConnections - 
initialNumberOfConnections
protected int initialNumberOfConnections - 
waitTimeout
protected int waitTimeout - 
connectionsAvailable
 - 
connectionsUsed
 - 
login
 - 
name
 - 
owner
 - 
checkConnections
protected volatile boolean checkConnections - 
timeOfDeath
protected volatile long timeOfDeath - 
deadCheckTime
protected volatile long deadCheckTime - 
isDead
protected volatile boolean isDead - 
failoverConnectionPools
 - 
DEAD_CHECK_TIME
public static final long DEAD_CHECK_TIME- See Also:
 
 - 
MAX_CONNECTIONS
public static final int MAX_CONNECTIONS- See Also:
 
 - 
MIN_CONNECTIONS
public static final int MIN_CONNECTIONS- See Also:
 
 - 
INITIAL_CONNECTIONS
public static final int INITIAL_CONNECTIONS- See Also:
 
 - 
WAIT_TIMEOUT
public static final int WAIT_TIMEOUT- See Also:
 
 
 - 
 - 
Constructor Details
- 
ConnectionPool
public ConnectionPool()PUBLIC: A connection pool is used to specify how connection should be pooled in a server session. - 
ConnectionPool
PUBLIC: A connection pool is used to specify how connection should be pooled in a server session. - 
ConnectionPool
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. - 
ConnectionPool
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 Details
- 
failover
public org.eclipse.persistence.internal.databaseaccess.Accessor failover()INTERNAL: The connection pool is dead fail over to the fail-over pool. - 
acquireConnection
public org.eclipse.persistence.internal.databaseaccess.Accessor acquireConnection() throws ConcurrencyExceptionINTERNAL: Wait until a connection is available and allocate the connection for the client.- Throws:
 ConcurrencyException
 - 
buildConnection
protected org.eclipse.persistence.internal.databaseaccess.Accessor buildConnection()INTERNAL: Create a new connection, accessors are used as connections. - 
getConnectionsAvailable
INTERNAL: returns the connections currently available for use in the pool - 
getConnectionsUsed
Return a list of the connections that are being used.- Returns:
 - java.util.Vector
 
 - 
getLogin
PUBLIC: Return the login used to create connections. - 
getMaxNumberOfConnections
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. - 
getMinNumberOfConnections
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. - 
getName
PUBLIC: Return the name of this pool. Pools are identified by name to allow multiple connection pools. - 
getOwner
Return the ServerSession that is the owner of this connection pool.- Returns:
 - org.eclipse.persistence.sessions.server.ServerSession
 
 - 
getTotalNumberOfConnections
public int getTotalNumberOfConnections()INTERNAL: Return the total number of connections currently in use. - 
hasConnectionAvailable
public boolean hasConnectionAvailable()INTERNAL: Wait until a connection is avaiable and allocate the connection for the client. - 
isConnected
public boolean isConnected()INTERNAL: Return if this pool has been connected to the database. - 
isThereConflictBetweenLoginAndType
public boolean isThereConflictBetweenLoginAndType()INTERNAL: Checks for a conflict between pool's type and pool's login - 
releaseConnection
public void releaseConnection(org.eclipse.persistence.internal.databaseaccess.Accessor connection) throws DatabaseException INTERNAL: Add the connection as single that a new connection is available.- Throws:
 DatabaseException
 - 
resetConnections
public void resetConnections()INTERNAL: Reset the connections on shutDown and when the pool is started. - 
setCheckConnections
public void setCheckConnections()INTERNAL: This method is called to indicate that all available connections should be checked. - 
setConnectionsAvailable
INTERNAL: Set this list of connections available- Parameters:
 connectionsAvailable-
 - 
setConnectionsUsed
INTERNAL: Set the list of connections being used.- Parameters:
 connectionsUsed-
 - 
setIsConnected
public void setIsConnected(boolean isConnected) INTERNAL: Set if this pool has been connected to the database. - 
setLogin
PUBLIC: Set the login used to create connections. - 
getInitialNumberOfConnections
public int getInitialNumberOfConnections()PUBLIC: Return the initial number of connections allowed. This is the number of connections connected on startup. - 
setInitialNumberOfConnections
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. - 
setMaxNumberOfConnections
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. - 
setMinNumberOfConnections
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. - 
setName
PUBLIC: Set the name of this pool. Pools are identified by name to allow multiple connection pools. - 
setOwner
Set the ServerSession that owns this connection pool- Parameters:
 owner-
 - 
shutDown
public void shutDown()INTERNAL: Disconnect all connections. - 
startUp
public void startUp()INTERNAL: Allocate the minimum connections. - 
toString
INTERNAL: return a string representation of this connection pool - 
getWaitTimeout
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. - 
setWaitTimeout
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. - 
isDead
public boolean isDead()ADVANCED: Return if the connection pool's database is down, and failover should be used. - 
setIsDead
public void setIsDead(boolean isDead) ADVANCED: Set if the connection pool's database is down, and failover should be used. - 
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. - 
setFailoverConnectionPools
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. - 
addFailoverConnectionPool
PUBLIC: Add the connection pool to used if this pool database goes down. The failover pools should be a clustered, replicated or backuped database. 
 -