Apache JMeter
2.0.1.20050615

org.apache.jmeter.protocol.jdbc.util
Class DBConnectionManager

java.lang.Object
  extended byorg.apache.jmeter.protocol.jdbc.util.DBConnectionManager

public final class DBConnectionManager
extends Object

This class manages a pool of Connection objects (ConnectionObject). This pool is constantly checked for old, over-used, or dead connections in a separated thread. Connections are rented out and then given back by the DBConnect object and its subclasses. This class is not directly accessed by the end-user objects. It is accessed by the DBConnect object and its subclasses.

Version:
$Revision: 1.12 $
Author:
Michael Stover, Jeremy Arnold

Method Summary
 Connection getConnection(DBKey key)
          Rents out a database connection object.
 DBKey getKey(String url, String username, String password, String driver, Map properties)
          Starts the connection manager going for a given database connection, and returns the DBKey object required to get a Connection object for this database.
static DBConnectionManager getManager()
           
 void releaseConnection(DBKey key, Connection c)
          Releases a connection back to the pool.
 void shutdown()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

getManager

public static DBConnectionManager getManager()

getKey

public DBKey getKey(String url,
                    String username,
                    String password,
                    String driver,
                    Map properties)
             throws ConnectionPoolException
Starts the connection manager going for a given database connection, and returns the DBKey object required to get a Connection object for this database.

Parameters:
url - URL of database to be connected to.
username - username to use to connect to database.
password - password to use to connect to database.
driver - driver to use for the database.
properties - configuration properties to be used by the connection pool.
Returns:
DBKey object. Returns null if connection fails.
Throws:
ConnectionPoolException

shutdown

public void shutdown()

getConnection

public Connection getConnection(DBKey key)
                         throws NoConnectionsAvailableException
Rents out a database connection object.

Returns:
Connection object.
Throws:
NoConnectionsAvailableException

releaseConnection

public void releaseConnection(DBKey key,
                              Connection c)
Releases a connection back to the pool.

Parameters:
c - Connection object being returned

Apache JMeter
2.0.1.20050615

Copyright © 1998-2005 Apache Software Foundation. All Rights Reserved.