org.apache.torque.pool
Class ConnectionPool

java.lang.Object
  extended byorg.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

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 $
Author:
Costas Stergiou, Frank Y. Kim, Brett McLaughlin, Greg Ritter, Daniel L. Rall, Paul O'Leary, Magn�s ��r Torfason, Jon S. Stevens, John McNally, Henning P. Schmiedehausen

Nested Class Summary
protected  class ConnectionPool.Monitor
          Deprecated. This inner class monitors the PoolBrokerService.
 
Field Summary
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
 
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
 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.
(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
(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
(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_EXPIRY_TIME

public static final int DEFAULT_EXPIRY_TIME
Deprecated. 
Default Expiry Time for a pool: 1 hour

See Also:
Constant Field Values

DEFAULT_CONNECTION_WAIT_TIMEOUT

public static final int DEFAULT_CONNECTION_WAIT_TIMEOUT
Deprecated. 
Default Connect Wait Timeout: 10 Seconds

See Also:
Constant Field Values
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 ConnectionPool with the default attributes.

Parameters:
cpds - The datasource
username - The user name for this pool.
password - The password for this pool.
maxConnections - max number of connections
expiryTime - connection expiry time
connectionWaitTimeout - timeout
logInterval - log interval
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.

Parameters:
username - The name of the database user.
password - The password of the database user.
Returns:
A database connection.
Throws:
java.sql.SQLException - if there is aproblem with the db connection

finalize

protected void finalize()
                 throws java.lang.Throwable
Deprecated. 
Close any open connections when this object is garbage collected.

Throws:
java.lang.Throwable - Anything might happen...

shutdown

void shutdown()
Deprecated. 
Close all connections to the database,


getTotalCount

int getTotalCount()
Deprecated. 
Returns the Total connections in the pool

Returns:
total connections in the pool

getNbrAvailable

int getNbrAvailable()
Deprecated. 
Returns the available connections in the pool

Returns:
number of available connections in the pool

getNbrCheckedOut

int getNbrCheckedOut()
Deprecated. 
Returns the checked out connections in the pool

Returns:
number of checked out connections in the pool

decrementConnections

void decrementConnections()
Deprecated. 
Decreases the count of connections in the pool and also calls notify().


getPoolName

java.lang.String getPoolName()
Deprecated. 
Get the name of the pool

Returns:
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:
connectionClosed in interface javax.sql.ConnectionEventListener
Parameters:
event - the connection event

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:
connectionErrorOccurred in interface javax.sql.ConnectionEventListener
Parameters:
event - the connection event


Copyright © 2000-2004 Apache Software Foundation. All Rights Reserved.