connectionpool
Interface Pool

All Known Implementing Classes:
ConnectionPool

public abstract interface Pool

This interface defines the behavior of the class that will manage the connections i.e a single pool of connections.


Method Summary
 void addConnectionLeakListener(ConnectionLeakListener cle)
          This method adds a connection leak listener.
 java.sql.Connection getConnection()
          This method returns a Connection from the connection pool.
 java.sql.Connection getConnection(java.lang.String owner)
          This method returns a Connection from the pool.
 java.util.Vector getConnectionLeakListeners()
           
 java.util.Vector getConnectionsInUse()
           
 int getCurrentPoolSize()
          This method returns the current size of the pool.
 int getNoOfFreeConnections()
           
 void releaseConnections()
          This method releases excessive connections.
 void removeConnectionLeakListener(ConnectionLeakListener cle)
          This method removes a connection leak listener.cle will not get any further notifications.
 void returnConnection(java.sql.Connection conn)
          This method releases the Connection conn to the pool.
 

Method Detail

getConnection

public java.sql.Connection getConnection()
                                  throws ConnectionPoolException
This method returns a Connection from the connection pool. The owner of this pool is marked as N/A indicating unknown. Note: This method blocks if the pool size has reached it's maximum size and no free connections are available until a free connection is available. The time period for which this method blocks depends on the connection-wait-time-out specified in the configuration file.
Returns:
Connection from the pool
Throws:
ConnectionPoolException - if there is any problem getting connection.

getConnection

public java.sql.Connection getConnection(java.lang.String owner)
                                  throws ConnectionPoolException
This method returns a Connection from the pool. The owner of this connection is identified by owner . Note: This method blocks if the pool size has reached it's maximum size and no free connections are available until a free connection is available. The time period for which this method blocks depends on the connection-wait-time-out specified in the configuration file.
Parameters:
owner - String identifying the owner.
Returns:
Connection from the pool
Throws:
ConnectionPoolException - if there is any problem getting connection.

getCurrentPoolSize

public int getCurrentPoolSize()
This method returns the current size of the pool.
Returns:
Current size of the pool

returnConnection

public void returnConnection(java.sql.Connection conn)
This method releases the Connection conn to the pool.

getConnectionsInUse

public java.util.Vector getConnectionsInUse()
Returns:
Vector of connections in use

getConnectionLeakListeners

public java.util.Vector getConnectionLeakListeners()
Returns:
Vector of registered ConnectionLeakListeners

getNoOfFreeConnections

public int getNoOfFreeConnections()
Returns:
Number of free connections in the pool.

addConnectionLeakListener

public void addConnectionLeakListener(ConnectionLeakListener cle)
                               throws ConnectionPoolException
This method adds a connection leak listener. The methods of cle will be called when a leak is detected as per the pool configuration.
Parameters:
cle - Class implementing ConnectionLeakListener interface.
Throws:
ConnectionPoolException - If there is any problem adding ConnectionLeakListener.

removeConnectionLeakListener

public void removeConnectionLeakListener(ConnectionLeakListener cle)
                                  throws ConnectionPoolException
This method removes a connection leak listener.cle will not get any further notifications.
Parameters:
cle - Class implementing ConnectionLeakListener interface.
Throws:
ConnectionPoolException - If there is any problem removing ConnectionLeakListener.

releaseConnections

public void releaseConnections()
This method releases excessive connections.