|
|||||||||
| Home >> All >> org >> apache >> torque >> [ pool overview ] | PREV CLASS NEXT CLASS | ||||||||
SUMMARY: JAVADOC | SOURCE | DOWNLOAD | NESTED | FIELD | CONSTR | METHOD |
DETAIL: FIELD | CONSTR | METHOD | ||||||||
org.apache.torque.pool
Class ConnectionPool

java.lang.Objectorg.apache.torque.pool.ConnectionPool
- All Implemented Interfaces:
- javax.sql.ConnectionEventListener, java.util.EventListener
Deprecated. as of version 3.1
- class ConnectionPool
- extends java.lang.Object
- implements javax.sql.ConnectionEventListener
- extends java.lang.Object
This class implements a simple connection pooling scheme.
- Version:
- $Id: ConnectionPool.java,v 1.27.2.2 2004/05/20 04:36:05 seade Exp $
| Nested Class Summary | |
protected class |
ConnectionPool.Monitor
Deprecated. This inner class monitors the PoolBrokerService. |
| Field Summary | |
private long |
connectionWaitTimeout
Deprecated. Amount of time a thread asking the pool for a cached connection will wait before timing out and throwing an error. |
private javax.sql.ConnectionPoolDataSource |
cpds
Deprecated. The ConnectionPoolDataSource |
static int |
DEFAULT_CONNECTION_WAIT_TIMEOUT
Deprecated. Default Connect Wait Timeout: 10 Seconds |
static int |
DEFAULT_EXPIRY_TIME
Deprecated. Default Expiry Time for a pool: 1 hour |
static int |
DEFAULT_MAX_CONNECTIONS
Deprecated. Default maximum Number of connections from this pool: One |
private long |
expiryTime
Deprecated. The amount of time in milliseconds that a connection will be pooled. |
private static org.apache.commons.logging.Log |
log
Deprecated. The logging logger. |
private int |
logInterval
Deprecated. Interval (in seconds) that the monitor thread reports the pool state |
private int |
maxConnections
Deprecated. The maximum number of database connections that can be created. |
private ConnectionPool.Monitor |
monitor
Deprecated. Monitor thread reporting the pool state |
private java.lang.String |
password
Deprecated. The password for this pool. |
private java.util.Stack |
pool
Deprecated. Pool containing database connections. |
private java.util.Map |
timeStamps
Deprecated. Keep track of when connections were created. |
private int |
totalConnections
Deprecated. The current number of database connections that have been created. |
private java.lang.String |
url
Deprecated. The url for this pool. |
private java.lang.String |
username
Deprecated. The user name for this pool. |
private int |
waitCount
Deprecated. Counter that keeps track of the number of threads that are in the wait state, waiting to aquire a connection. |
| Constructor Summary | |
(package private) |
ConnectionPool(javax.sql.ConnectionPoolDataSource cpds,
java.lang.String username,
java.lang.String password,
int maxConnections,
int expiryTime,
int connectionWaitTimeout,
int logInterval)
Deprecated. Creates a ConnectionPool with the default
attributes. |
| Method Summary | |
private void |
closePooledConnection(javax.sql.PooledConnection pcon)
Deprecated. |
void |
connectionClosed(javax.sql.ConnectionEvent event)
Deprecated. This will be called if the Connection returned by the getConnection method came from a PooledConnection, and the user calls the close() method of this connection object. |
void |
connectionErrorOccurred(javax.sql.ConnectionEvent event)
Deprecated. If a fatal error occurs, close the underlying physical connection so as not to be returned in the future |
(package private) void |
decrementConnections()
Deprecated. Decreases the count of connections in the pool and also calls notify(). |
protected void |
finalize()
Deprecated. Close any open connections when this object is garbage collected. |
(package private) javax.sql.PooledConnection |
getConnection(java.lang.String username,
java.lang.String password)
Deprecated. Returns a connection that maintains a link to the pool it came from. |
private javax.sql.PooledConnection |
getInternalPooledConnection()
Deprecated. Gets a pooled database connection. |
(package private) int |
getNbrAvailable()
Deprecated. Returns the available connections in the pool |
(package private) int |
getNbrCheckedOut()
Deprecated. Returns the checked out connections in the pool |
private javax.sql.PooledConnection |
getNewConnection()
Deprecated. Returns a fresh connection to the database. |
(package private) java.lang.String |
getPoolName()
Deprecated. Get the name of the pool |
(package private) int |
getTotalCount()
Deprecated. Returns the Total connections in the pool |
private boolean |
isExpired(javax.sql.PooledConnection pc)
Deprecated. Helper method which determines whether a connection has expired. |
private boolean |
isValid(javax.sql.PooledConnection connection)
Deprecated. Determines if a connection is still valid. |
private javax.sql.PooledConnection |
popConnection()
Deprecated. Helper function that attempts to pop a connection off the pool's stack, handling the case where the popped connection has become invalid by creating a new connection. |
private void |
releaseConnection(javax.sql.PooledConnection pcon)
Deprecated. This method returns a connection to the pool, and must be called by the requestor when finished with the connection. |
(package private) void |
shutdown()
Deprecated. Close all connections to the database, |
| Methods inherited from class java.lang.Object |
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
DEFAULT_MAX_CONNECTIONS
public static final int DEFAULT_MAX_CONNECTIONS
- Deprecated.
- Default maximum Number of connections from this pool: One
- See Also:
- Constant Field Values
- Default maximum Number of connections from this pool: One
DEFAULT_EXPIRY_TIME
public static final int DEFAULT_EXPIRY_TIME
- Deprecated.
- Default Expiry Time for a pool: 1 hour
- See Also:
- Constant Field Values
- Default Expiry Time for a pool: 1 hour
DEFAULT_CONNECTION_WAIT_TIMEOUT
public static final int DEFAULT_CONNECTION_WAIT_TIMEOUT
- Deprecated.
- Default Connect Wait Timeout: 10 Seconds
- See Also:
- Constant Field Values
- Default Connect Wait Timeout: 10 Seconds
pool
private java.util.Stack pool
- Deprecated.
- Pool containing database connections.
- Pool containing database connections.
url
private java.lang.String url
- Deprecated.
- The url for this pool.
- The url for this pool.
username
private java.lang.String username
- Deprecated.
- The user name for this pool.
- The user name for this pool.
password
private java.lang.String password
- Deprecated.
- The password for this pool.
- The password for this pool.
totalConnections
private int totalConnections
- Deprecated.
- The current number of database connections that have been created.
- The current number of database connections that have been created.
maxConnections
private int maxConnections
- Deprecated.
- The maximum number of database connections that can be created.
- The maximum number of database connections that can be created.
expiryTime
private long expiryTime
- Deprecated.
- The amount of time in milliseconds that a connection will be pooled.
- The amount of time in milliseconds that a connection will be pooled.
waitCount
private int waitCount
- Deprecated.
- Counter that keeps track of the number of threads that are in the wait state, waiting to aquire a connection.
- Counter that keeps track of the number of threads that are in the wait state, waiting to aquire a connection.
log
private static org.apache.commons.logging.Log log
- Deprecated.
- The logging logger.
- The logging logger.
logInterval
private int logInterval
- Deprecated.
- Interval (in seconds) that the monitor thread reports the pool state
- Interval (in seconds) that the monitor thread reports the pool state
monitor
private ConnectionPool.Monitor monitor
- Deprecated.
- Monitor thread reporting the pool state
- Monitor thread reporting the pool state
connectionWaitTimeout
private long connectionWaitTimeout
- Deprecated.
- Amount of time a thread asking the pool for a cached connection will wait before timing out and throwing an error.
- Amount of time a thread asking the pool for a cached connection will wait before timing out and throwing an error.
cpds
private javax.sql.ConnectionPoolDataSource cpds
- Deprecated.
- The ConnectionPoolDataSource
- The ConnectionPoolDataSource
timeStamps
private java.util.Map timeStamps
- Deprecated.
- Keep track of when connections were created. Keyed by a PooledConnection and value is a java.util.Date
- Keep track of when connections were created. Keyed by a PooledConnection and value is a java.util.Date
| Constructor Detail |
ConnectionPool
ConnectionPool(javax.sql.ConnectionPoolDataSource cpds, java.lang.String username, java.lang.String password, int maxConnections, int expiryTime, int connectionWaitTimeout, int logInterval)
- Deprecated.
- Creates a
ConnectionPoolwith the default attributes. - Creates a
| Method Detail |
getConnection
final javax.sql.PooledConnection getConnection(java.lang.String username, java.lang.String password) throws java.sql.SQLException
- Deprecated.
- Returns a connection that maintains a link to the pool it came from.
- Returns a connection that maintains a link to the pool it came from.
getNewConnection
private javax.sql.PooledConnection getNewConnection() throws java.sql.SQLException
- Deprecated.
- Returns a fresh connection to the database. The database type is specified by
driver, and its connection information byurl,username, andpassword. - Returns a fresh connection to the database. The database type is specified by
getInternalPooledConnection
private javax.sql.PooledConnection getInternalPooledConnection() throws ConnectionWaitTimeoutException, java.lang.Exception
- Deprecated.
- Gets a pooled database connection.
- Gets a pooled database connection.
popConnection
private javax.sql.PooledConnection popConnection() throws java.lang.Exception
- Deprecated.
- Helper function that attempts to pop a connection off the pool's stack, handling the case where the popped connection has become invalid by creating a new connection.
- Helper function that attempts to pop a connection off the pool's stack, handling the case where the popped connection has become invalid by creating a new connection.
isExpired
private boolean isExpired(javax.sql.PooledConnection pc)
- Deprecated.
- Helper method which determines whether a connection has expired.
- Helper method which determines whether a connection has expired.
isValid
private boolean isValid(javax.sql.PooledConnection connection)
- Deprecated.
- Determines if a connection is still valid.
- Determines if a connection is still valid.
finalize
protected void finalize()
throws java.lang.Throwable
- Deprecated.
- Close any open connections when this object is garbage collected.
- Close any open connections when this object is garbage collected.
shutdown
void shutdown()
- Deprecated.
- Close all connections to the database,
- Close all connections to the database,
getTotalCount
int getTotalCount()
- Deprecated.
- Returns the Total connections in the pool
- Returns the Total connections in the pool
getNbrAvailable
int getNbrAvailable()
- Deprecated.
- Returns the available connections in the pool
- Returns the available connections in the pool
getNbrCheckedOut
int getNbrCheckedOut()
- Deprecated.
- Returns the checked out connections in the pool
- Returns the checked out connections in the pool
decrementConnections
void decrementConnections()
- Deprecated.
- Decreases the count of connections in the pool and also calls
notify(). - Decreases the count of connections in the pool and also calls
getPoolName
java.lang.String getPoolName()
- Deprecated.
- Get the name of the pool
- Get the name of the pool
connectionClosed
public void connectionClosed(javax.sql.ConnectionEvent event)
- Deprecated.
- This will be called if the Connection returned by the getConnection method came from a PooledConnection, and the user calls the close() method of this connection object. What we need to do here is to release this PooledConnection from our pool...
- Specified by:
connectionClosedin interfacejavax.sql.ConnectionEventListener
- This will be called if the Connection returned by the getConnection method came from a PooledConnection, and the user calls the close() method of this connection object. What we need to do here is to release this PooledConnection from our pool...
connectionErrorOccurred
public void connectionErrorOccurred(javax.sql.ConnectionEvent event)
- Deprecated.
- If a fatal error occurs, close the underlying physical connection so as not to be returned in the future
- Specified by:
connectionErrorOccurredin interfacejavax.sql.ConnectionEventListener
- If a fatal error occurs, close the underlying physical connection so as not to be returned in the future
releaseConnection
private void releaseConnection(javax.sql.PooledConnection pcon)
- Deprecated.
- This method returns a connection to the pool, and must be called by the requestor when finished with the connection.
- This method returns a connection to the pool, and must be called by the requestor when finished with the connection.
closePooledConnection
private void closePooledConnection(javax.sql.PooledConnection pcon)
- Deprecated.
|
|||||||||
| Home >> All >> org >> apache >> torque >> [ pool overview ] | PREV CLASS NEXT CLASS | ||||||||
SUMMARY: JAVADOC | SOURCE | DOWNLOAD | NESTED | FIELD | CONSTR | METHOD |
DETAIL: FIELD | CONSTR | METHOD | ||||||||
JAVADOC
org.apache.torque.pool.ConnectionPool