|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.apache.ojb.broker.accesslayer.ConnectionFactoryAbstractImpl org.apache.ojb.broker.accesslayer.ConnectionFactoryPooledImpl
public class ConnectionFactoryPooledImpl
Connection factory which pools the requested connections for different JdbcConnectionDescriptors using Commons Pool API.
Nested Class Summary | |
---|---|
(package private) class |
ConnectionFactoryPooledImpl.ConPoolFactory
Inner class - PoolableObjectFactory
used as factory for connection pooling. |
Field Summary | |
---|---|
private Logger |
log
|
private Map |
poolMap
Key=PBKey, value=ObjectPool. |
private Object |
poolSynch
Synchronize object for operations not synchronized on Map only. |
Constructor Summary | |
---|---|
ConnectionFactoryPooledImpl()
|
Method Summary | |
---|---|
Connection |
checkOutJdbcConnection(JdbcConnectionDescriptor jcd)
Returns a valid JDBC Connection. |
org.apache.commons.pool.ObjectPool |
createConnectionPool(JdbcConnectionDescriptor jcd)
Create the pool for pooling the connections of the given connection descriptor. |
void |
releaseAllResources()
Closes all managed pools. |
void |
releaseJdbcConnection(JdbcConnectionDescriptor jcd,
Connection con)
Releases a Connection after use. |
Methods inherited from class org.apache.ojb.broker.accesslayer.ConnectionFactoryAbstractImpl |
---|
getDbURL, getJcdDescription, getJdbcProperties, getJdbcProperties, initializeJdbcConnection, lookupConnection, newConnectionFromDataSource, newConnectionFromDriverManager, releaseConnection |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
private Logger log
private Map poolMap
private final Object poolSynch
Constructor Detail |
---|
public ConnectionFactoryPooledImpl()
Method Detail |
---|
public void releaseJdbcConnection(JdbcConnectionDescriptor jcd, Connection con) throws LookupException
ConnectionFactoryAbstractImpl
Note: This method is never called for a jdbc-connection-descriptor that uses datasources, OJB only manages connections from DriverManager.
releaseJdbcConnection
in class ConnectionFactoryAbstractImpl
jcd
- the connection descriptor for which the connection was createdcon
- the connection to release.
Callers must guarantee that the passed connection was obtained by calling
ConnectionFactoryAbstractImpl.checkOutJdbcConnection(org.apache.ojb.broker.metadata.JdbcConnectionDescriptor)
.
LookupException
- if errors occured during release of object. Typically happens
if return of object to pool fails in a pooled implementation.public Connection checkOutJdbcConnection(JdbcConnectionDescriptor jcd) throws LookupException
ConnectionFactoryAbstractImpl
Note: This method is never called for a jdbc-connection-descriptor that uses datasources, OJB only manages connections from DriverManager.
Note: If the concrete implementation does not callback to
ConnectionFactoryAbstractImpl.newConnectionFromDriverManager(org.apache.ojb.broker.metadata.JdbcConnectionDescriptor)
when creating a new Connection, it must call
ConnectionFactoryAbstractImpl.initializeJdbcConnection(java.sql.Connection, org.apache.ojb.broker.metadata.JdbcConnectionDescriptor)
so that the platform implementation can peform any RDBMS-specific init tasks for newly
created Connection objetcs.
checkOutJdbcConnection
in class ConnectionFactoryAbstractImpl
jcd
- the connection descriptor for which to return a validated Connection
LookupException
- if a valid Connection could not be obtainedpublic org.apache.commons.pool.ObjectPool createConnectionPool(JdbcConnectionDescriptor jcd)
ObjectPool
.
public void releaseAllResources()
releaseAllResources
in interface ConnectionFactory
releaseAllResources
in class ConnectionFactoryAbstractImpl
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |