com.mf.kennewick.broker
Class ConnectionManager

java.lang.Object
  extended bycom.mf.kennewick.broker.ConnectionManager

public class ConnectionManager
extends java.lang.Object

For relational database broker layers, this class implements connection pooling and deals with establishing JDBC connections. A word on Kennewick connection pooling: The Kennewick framework does provide a simple form of connection pooling for applications that require it and have no other reliable form of connection pooling available. The connection pooling feature was created to work around instability in Oracle's pooling drivers. In situations where database or application server provided drivers can be counted on to pool connections without hanging or crashing, it is recommended that Kennewick connection pooling be turned off.

Author:
Jeffrey Payne

Constructor Summary
ConnectionManager(DatasourceConfiguration config)
          Creates a new connection manager.
 
Method Summary
 void deprecateConnection(java.sql.Connection aConnection)
          Flags a connection as being expired and no longer issuable by the getConnection() method Once called, this connection will stay open until all statements and resultsets open against it are closed, then it will be closed.
 java.sql.Connection getConnection(boolean forceNewConnection, boolean lockConnection)
           
 java.sql.Connection getConnection(boolean forceNewConnection, boolean lockConnection, int retryCount)
          Returns a JDBC connection which may be created from scratch or selected from a pool depending on input parameters and system configuration.
 int getConnectionCount()
           
 int getConnectionTimout()
           
 java.lang.String getDatasourceId()
           
 java.lang.String getJndiName()
           
 int getPurgeInterval()
           
 int getQueryLimit()
           
 java.lang.String getTableQualifer()
           
 boolean isPoolingEnabled()
           
static java.sql.ResultSet runSimpleQuery(java.lang.String sql)
          Convenience method for running a database query when no protection of the resultset from closure is required.
 void unlockConnection(java.sql.Connection aConnection)
          Restores a connection locked for exclusive use to the pool.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ConnectionManager

public ConnectionManager(DatasourceConfiguration config)
Creates a new connection manager. Called by the framework. Application implementors should never need to directly instantiate a ConnectionManager.

Method Detail

unlockConnection

public void unlockConnection(java.sql.Connection aConnection)
Restores a connection locked for exclusive use to the pool.

Parameters:
aConnection -

runSimpleQuery

public static java.sql.ResultSet runSimpleQuery(java.lang.String sql)
                                         throws java.sql.SQLException
Convenience method for running a database query when no protection of the resultset from closure is required. Typically this would be used for queries that are only expected to return one row.

Parameters:
sql -
Returns:
Throws:
java.sql.SQLException

deprecateConnection

public void deprecateConnection(java.sql.Connection aConnection)
Flags a connection as being expired and no longer issuable by the getConnection() method Once called, this connection will stay open until all statements and resultsets open against it are closed, then it will be closed.

Parameters:
aConnection -

getConnection

public java.sql.Connection getConnection(boolean forceNewConnection,
                                         boolean lockConnection)

getConnection

public java.sql.Connection getConnection(boolean forceNewConnection,
                                         boolean lockConnection,
                                         int retryCount)
Returns a JDBC connection which may be created from scratch or selected from a pool depending on input parameters and system configuration.

Parameters:
forceNewConnection -
lockConnection -
Returns:

getConnectionCount

public int getConnectionCount()

getConnectionTimout

public int getConnectionTimout()
Returns:

getDatasourceId

public java.lang.String getDatasourceId()
Returns:

getJndiName

public java.lang.String getJndiName()
Returns:

isPoolingEnabled

public boolean isPoolingEnabled()
Returns:

getPurgeInterval

public int getPurgeInterval()
Returns:

getQueryLimit

public int getQueryLimit()
Returns:

getTableQualifer

public java.lang.String getTableQualifer()
Returns:


Copyright © 2004 Media Fortress, LLC, LLC. Licensed for commercial use under the Apache 2.0 License.