org.apache.ojb.broker.accesslayer
Class ConnectionFactoryPooledImpl

java.lang.Object
  extended byorg.apache.ojb.broker.accesslayer.ConnectionFactoryAbstractImpl
      extended byorg.apache.ojb.broker.accesslayer.ConnectionFactoryPooledImpl
All Implemented Interfaces:
ConnectionFactory

public class ConnectionFactoryPooledImpl
extends ConnectionFactoryAbstractImpl

Connection factory which pools the requested connections for different JdbcConnectionDescriptors using jakarta-commons-pool api.

Version:
$Id: ConnectionFactoryPooledImpl.java,v 1.7 2003/06/11 23:51:00 arminw Exp $
Author:
Armin Waibel.

Nested Class Summary
(package private)  class ConnectionFactoryPooledImpl.ConPoolFactory
          Inner class - PoolableObjectFactory used as factory for connection pooling
 
Constructor Summary
ConnectionFactoryPooledImpl()
           
 
Method Summary
 org.apache.commons.pool.ObjectPool createConnectionPool(JdbcConnectionDescriptor jcd)
          Create the pool for pooling the connections of the given connection descriptor.
 java.sql.Connection getConnectionFromPool(JdbcConnectionDescriptor jcd)
          Implement this method.
 void releaseAllResources()
          Closes all managed pools.
 void returnConnectionToPool(JdbcConnectionDescriptor jcd, java.sql.Connection con)
          Implement this method.
 
Methods inherited from class org.apache.ojb.broker.accesslayer.ConnectionFactoryAbstractImpl
getDbURL, initializeJdbcConnection, lookupConnection, newConnectionFromDataSource, newConnectionFromDriverManager, releaseConnection
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ConnectionFactoryPooledImpl

public ConnectionFactoryPooledImpl()
Method Detail

returnConnectionToPool

public void returnConnectionToPool(JdbcConnectionDescriptor jcd,
                                   java.sql.Connection con)
                            throws LookupException
Description copied from class: ConnectionFactoryAbstractImpl
Implement this method. Was called to return a connection to pool.
Note: This method was not called, if the jdbc-connection-descriptor uses datasources - OJB only pool connections from DriverManager.

Specified by:
returnConnectionToPool in class ConnectionFactoryAbstractImpl
Throws:
LookupException

getConnectionFromPool

public java.sql.Connection getConnectionFromPool(JdbcConnectionDescriptor jcd)
                                          throws LookupException
Description copied from class: ConnectionFactoryAbstractImpl
Implement this method. This method was called to obtain a jdbc-connection from the pool.
Note: This method was not called, if jdbc-connection-descriptor use datasources - OJB only pool connections from DriverManager.

Specified by:
getConnectionFromPool in class ConnectionFactoryAbstractImpl
Throws:
LookupException

createConnectionPool

public org.apache.commons.pool.ObjectPool createConnectionPool(JdbcConnectionDescriptor jcd)
Create the pool for pooling the connections of the given connection descriptor. Override this method to implement your on ObjectPool.


releaseAllResources

public void releaseAllResources()
Closes all managed pools.

Specified by:
releaseAllResources in interface ConnectionFactory
Overrides:
releaseAllResources in class ConnectionFactoryAbstractImpl


Authors: Thomas Mahler and others. (C) 2000 - 2003 Apache Software Foundation
All rights reserved. Published under the Apache License.
http://db.apache.org/ojb
Version: 1.0.rc5, 2003-12-14