com.ca.jcs.cfg
Class GenericObjectPoolConnectionManager

java.lang.Object
  extended by org.apache.commons.pool.BaseObjectPool
      extended by org.apache.commons.pool.impl.GenericObjectPool
          extended by com.ca.jcs.cfg.GenericObjectPoolConnectionManager
All Implemented Interfaces:
Activatable, ConnectionManager, ObjectPool
Direct Known Subclasses:
JNDIConnectionPool, JNDIKerberosConnectionPool, SDKWSConnectionPool, StubMetaConnectionPool

public abstract class GenericObjectPoolConnectionManager
extends GenericObjectPool
implements ConnectionManager

Simple adapter that delegates methods from connection manager to obvious matching methods on a pool. Note that the provided factory must pay very careful attention to distinguishing retriable soft failures from hard failures if resiliency is to be supported (refer to comments on ConnectionManager.borrowConnection()).

See Also:
GenericObjectPoolConfigBeanWrapper

Nested Class Summary
 
Nested classes/interfaces inherited from class org.apache.commons.pool.impl.GenericObjectPool
GenericObjectPool.Config
 
Field Summary
 
Fields inherited from class org.apache.commons.pool.impl.GenericObjectPool
DEFAULT_LIFO, DEFAULT_MAX_ACTIVE, DEFAULT_MAX_IDLE, DEFAULT_MAX_WAIT, DEFAULT_MIN_EVICTABLE_IDLE_TIME_MILLIS, DEFAULT_MIN_IDLE, DEFAULT_NUM_TESTS_PER_EVICTION_RUN, DEFAULT_SOFT_MIN_EVICTABLE_IDLE_TIME_MILLIS, DEFAULT_TEST_ON_BORROW, DEFAULT_TEST_ON_RETURN, DEFAULT_TEST_WHILE_IDLE, DEFAULT_TIME_BETWEEN_EVICTION_RUNS_MILLIS, DEFAULT_WHEN_EXHAUSTED_ACTION, WHEN_EXHAUSTED_BLOCK, WHEN_EXHAUSTED_FAIL, WHEN_EXHAUSTED_GROW
 
Constructor Summary
GenericObjectPoolConnectionManager(PoolableObjectFactory factory, GenericObjectPool.Config config, Logger connLog)
           
GenericObjectPoolConnectionManager(PoolableObjectFactory factory, Logger log)
           
 
Method Summary
 void activate()
          Derived classes should override if need to perform some logic after construction is complete, does nothing in this class.
 Object borrowConnection()
          Delegates to GenericObjectPool.borrowObject(), but not comments about soft failures in comments for this class.
 void clearConnection()
          This method can be called to clear all existing connections in the pool when one is found to be in a in stale or inconsistent state.
 void deactivate()
          Derived classes should override if need to perform some logic when closing down the pool, just closes pool in this class.
 Logger getConnectorLogger()
           
 PoolableObjectFactory getFactory()
          For some reason this method isn't implemented in super class, so implement it here.
 void returnConnection(Object conn)
           
 void setFactory(PoolableObjectFactory factory)
           
 
Methods inherited from class org.apache.commons.pool.impl.GenericObjectPool
addObject, borrowObject, clear, close, evict, getLifo, getMaxActive, getMaxIdle, getMaxWait, getMinEvictableIdleTimeMillis, getMinIdle, getNumActive, getNumIdle, getNumTestsPerEvictionRun, getSoftMinEvictableIdleTimeMillis, getTestOnBorrow, getTestOnReturn, getTestWhileIdle, getTimeBetweenEvictionRunsMillis, getWhenExhaustedAction, invalidateObject, returnObject, setConfig, setLifo, setMaxActive, setMaxIdle, setMaxWait, setMinEvictableIdleTimeMillis, setMinIdle, setNumTestsPerEvictionRun, setSoftMinEvictableIdleTimeMillis, setTestOnBorrow, setTestOnReturn, setTestWhileIdle, setTimeBetweenEvictionRunsMillis, setWhenExhaustedAction, startEvictor
 
Methods inherited from class org.apache.commons.pool.BaseObjectPool
assertOpen, isClosed
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

GenericObjectPoolConnectionManager

public GenericObjectPoolConnectionManager(PoolableObjectFactory factory,
                                          GenericObjectPool.Config config,
                                          Logger connLog)

GenericObjectPoolConnectionManager

public GenericObjectPoolConnectionManager(PoolableObjectFactory factory,
                                          Logger log)
Method Detail

getFactory

public PoolableObjectFactory getFactory()
For some reason this method isn't implemented in super class, so implement it here.


getConnectorLogger

public Logger getConnectorLogger()

setFactory

public void setFactory(PoolableObjectFactory factory)
                throws IllegalStateException
Specified by:
setFactory in interface ObjectPool
Overrides:
setFactory in class GenericObjectPool
Throws:
IllegalStateException

borrowConnection

public Object borrowConnection()
                        throws NamingException
Delegates to GenericObjectPool.borrowObject(), but not comments about soft failures in comments for this class.

Specified by:
borrowConnection in interface ConnectionManager
Returns:
Non-null live connection.
Throws:
NamingException - If connection can't be borrowed, can't return null.

returnConnection

public void returnConnection(Object conn)
Specified by:
returnConnection in interface ConnectionManager

activate

public void activate()
              throws NamingException
Derived classes should override if need to perform some logic after construction is complete, does nothing in this class.

Specified by:
activate in interface Activatable
Throws:
NamingException

deactivate

public void deactivate()
                throws NamingException
Derived classes should override if need to perform some logic when closing down the pool, just closes pool in this class.

Specified by:
deactivate in interface Activatable
Throws:
NamingException

clearConnection

public void clearConnection()
                     throws NamingException
Description copied from interface: ConnectionManager
This method can be called to clear all existing connections in the pool when one is found to be in a in stale or inconsistent state. See RetryOpProcessorProxy for an example.

Specified by:
clearConnection in interface ConnectionManager
Throws:
NamingException


Created 2011-07-14 13:27 EST