public class ConnectionPool
extends java.lang.Object
Purpose: Used to specify how connection should be pooled in a server session.
ServerSession
Modifier and Type | Field and Description |
---|---|
protected boolean |
checkConnections |
protected java.util.List<org.eclipse.persistence.internal.databaseaccess.Accessor> |
connectionsAvailable |
protected java.util.List<org.eclipse.persistence.internal.databaseaccess.Accessor> |
connectionsUsed |
static long |
DEAD_CHECK_TIME |
protected long |
deadCheckTime |
protected java.util.List<java.lang.String> |
failoverConnectionPools |
static int |
INITIAL_CONNECTIONS |
protected int |
initialNumberOfConnections |
protected boolean |
isConnected |
protected boolean |
isDead |
protected Login |
login |
static int |
MAX_CONNECTIONS |
protected int |
maxNumberOfConnections |
static int |
MIN_CONNECTIONS |
protected int |
minNumberOfConnections |
protected static java.lang.String |
MONITOR_HEADER |
protected java.lang.String |
name |
protected ServerSession |
owner |
protected long |
timeOfDeath |
static int |
WAIT_TIMEOUT |
protected int |
waitTimeout |
Constructor and Description |
---|
ConnectionPool()
PUBLIC:
A connection pool is used to specify how connection should be pooled in a server session.
|
ConnectionPool(java.lang.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(java.lang.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(java.lang.String name,
Login login,
ServerSession owner)
PUBLIC:
A connection pool is used to specify how connection should be pooled in a server session.
|
Modifier and Type | Method and Description |
---|---|
org.eclipse.persistence.internal.databaseaccess.Accessor |
acquireConnection()
INTERNAL:
Wait until a connection is available and allocate the connection for the client.
|
boolean |
addFailoverConnectionPool(java.lang.String poolName)
PUBLIC:
Add the connection pool to used if this pool database goes down.
|
protected org.eclipse.persistence.internal.databaseaccess.Accessor |
buildConnection()
INTERNAL:
Create a new connection, accessors are used as connections.
|
org.eclipse.persistence.internal.databaseaccess.Accessor |
failover()
INTERNAL:
The connection pool is dead fail over to the fail-over pool.
|
java.util.List<org.eclipse.persistence.internal.databaseaccess.Accessor> |
getConnectionsAvailable()
INTERNAL:
returns the connections currently available for use in the pool
|
protected java.util.List<org.eclipse.persistence.internal.databaseaccess.Accessor> |
getConnectionsUsed()
Return a list of the connections that are being used.
|
java.util.List<java.lang.String> |
getFailoverConnectionPools()
PUBLIC:
Return the list of connection pools to used if this pool database goes down.
|
int |
getInitialNumberOfConnections()
PUBLIC:
Return the initial number of connections allowed.
|
Login |
getLogin()
PUBLIC:
Return the login used to create connections.
|
int |
getMaxNumberOfConnections()
PUBLIC:
Return the maximum number of connections allowed.
|
int |
getMinNumberOfConnections()
PUBLIC:
Return the minimum number of connections.
|
java.lang.String |
getName()
PUBLIC:
Return the name of this pool.
|
protected ServerSession |
getOwner()
Return the ServerSession that is the owner of this connection pool.
|
int |
getTotalNumberOfConnections()
INTERNAL:
Return the total number of connections currently in use.
|
int |
getWaitTimeout()
PUBLIC:
Return the time in milliseconds to wait for a available connection.
|
boolean |
hasConnectionAvailable()
INTERNAL:
Wait until a connection is avaiable and allocate the connection for the client.
|
boolean |
isConnected()
INTERNAL:
Return if this pool has been connected to the database.
|
boolean |
isDead()
ADVANCED:
Return if the connection pool's database is down, and failover should be used.
|
boolean |
isThereConflictBetweenLoginAndType()
INTERNAL:
Checks for a conflict between pool's type and pool's login
|
void |
releaseConnection(org.eclipse.persistence.internal.databaseaccess.Accessor connection)
INTERNAL:
Add the connection as single that a new connection is available.
|
void |
resetConnections()
INTERNAL:
Reset the connections on shutDown and when the pool is started.
|
void |
setCheckConnections()
INTERNAL:
This method is called to indicate that all available connections should be checked.
|
protected void |
setConnectionsAvailable(java.util.Vector connectionsAvailable)
INTERNAL:
Set this list of connections available
|
protected void |
setConnectionsUsed(java.util.Vector connectionsUsed)
INTERNAL:
Set the list of connections being used.
|
void |
setFailoverConnectionPools(java.util.List<java.lang.String> failoverConnectionPools)
PUBLIC:
Set the list of connection pools to used if this pool database goes down.
|
void |
setInitialNumberOfConnections(int initialNumberOfConnections)
PUBLIC:
Set the initial number of connections allowed.
|
void |
setIsConnected(boolean isConnected)
INTERNAL:
Set if this pool has been connected to the database.
|
void |
setIsDead(boolean isDead)
ADVANCED:
Set if the connection pool's database is down, and failover should be used.
|
void |
setLogin(Login login)
PUBLIC:
Set the login used to create connections.
|
void |
setMaxNumberOfConnections(int maxNumberOfConnections)
PUBLIC:
Set the maximum number of connections allowed.
|
void |
setMinNumberOfConnections(int minNumberOfConnections)
PUBLIC:
Set the minimum number of connections.
|
void |
setName(java.lang.String name)
PUBLIC:
Set the name of this pool.
|
protected void |
setOwner(ServerSession owner)
Set the ServerSession that owns this connection pool
|
void |
setWaitTimeout(int waitTimeout)
PUBLIC:
Set the time in milliseconds to wait for an available connection.
|
void |
shutDown()
INTERNAL:
Disconnect all connections.
|
void |
startUp()
INTERNAL:
Allocate the minimum connections.
|
java.lang.String |
toString()
INTERNAL:
return a string representation of this connection pool
|
protected static final java.lang.String MONITOR_HEADER
protected boolean isConnected
protected int maxNumberOfConnections
protected int minNumberOfConnections
protected int initialNumberOfConnections
protected int waitTimeout
protected java.util.List<org.eclipse.persistence.internal.databaseaccess.Accessor> connectionsAvailable
protected java.util.List<org.eclipse.persistence.internal.databaseaccess.Accessor> connectionsUsed
protected Login login
protected java.lang.String name
protected ServerSession owner
protected volatile boolean checkConnections
protected volatile long timeOfDeath
protected volatile long deadCheckTime
protected volatile boolean isDead
protected java.util.List<java.lang.String> failoverConnectionPools
public static final long DEAD_CHECK_TIME
public static final int MAX_CONNECTIONS
public static final int MIN_CONNECTIONS
public static final int INITIAL_CONNECTIONS
public static final int WAIT_TIMEOUT
public ConnectionPool()
public ConnectionPool(java.lang.String name, Login login, ServerSession owner)
public ConnectionPool(java.lang.String name, Login login, int minNumberOfConnections, int maxNumberOfConnections, ServerSession owner)
public ConnectionPool(java.lang.String name, Login login, int initialNumberOfConnections, int minNumberOfConnections, int maxNumberOfConnections, ServerSession owner)
public org.eclipse.persistence.internal.databaseaccess.Accessor failover()
public org.eclipse.persistence.internal.databaseaccess.Accessor acquireConnection() throws ConcurrencyException
ConcurrencyException
protected org.eclipse.persistence.internal.databaseaccess.Accessor buildConnection()
public java.util.List<org.eclipse.persistence.internal.databaseaccess.Accessor> getConnectionsAvailable()
protected java.util.List<org.eclipse.persistence.internal.databaseaccess.Accessor> getConnectionsUsed()
public Login getLogin()
public int getMaxNumberOfConnections()
public int getMinNumberOfConnections()
public java.lang.String getName()
protected ServerSession getOwner()
public int getTotalNumberOfConnections()
public boolean hasConnectionAvailable()
public boolean isConnected()
public boolean isThereConflictBetweenLoginAndType()
public void releaseConnection(org.eclipse.persistence.internal.databaseaccess.Accessor connection) throws DatabaseException
DatabaseException
public void resetConnections()
public void setCheckConnections()
protected void setConnectionsAvailable(java.util.Vector connectionsAvailable)
connectionsAvailable
- protected void setConnectionsUsed(java.util.Vector connectionsUsed)
connectionsUsed
- public void setIsConnected(boolean isConnected)
public void setLogin(Login login)
public int getInitialNumberOfConnections()
public void setInitialNumberOfConnections(int initialNumberOfConnections)
public void setMaxNumberOfConnections(int maxNumberOfConnections)
public void setMinNumberOfConnections(int minNumberOfConnections)
public void setName(java.lang.String name)
protected void setOwner(ServerSession owner)
owner
- public void shutDown()
public void startUp()
public java.lang.String toString()
toString
in class java.lang.Object
public int getWaitTimeout()
public void setWaitTimeout(int waitTimeout)
public boolean isDead()
public void setIsDead(boolean isDead)
public java.util.List<java.lang.String> getFailoverConnectionPools()
public void setFailoverConnectionPools(java.util.List<java.lang.String> failoverConnectionPools)
public boolean addFailoverConnectionPool(java.lang.String poolName)