org.outerj.xreporter.connectionprovider.pooling
Class PoolingConnectionProviderManager
java.lang.Object
org.apache.avalon.framework.logger.AbstractLogEnabled
org.outerj.xreporter.connectionprovider.AbstractConnectionProviderManager
org.outerj.xreporter.connectionprovider.pooling.PoolingConnectionProviderManager
- All Implemented Interfaces:
- org.apache.avalon.framework.configuration.Configurable, ConnectionProviderManager, org.apache.avalon.framework.activity.Disposable, org.apache.avalon.framework.activity.Initializable, org.apache.avalon.framework.logger.LogEnabled, org.apache.avalon.framework.thread.ThreadSafe
- public class PoolingConnectionProviderManager
- extends AbstractConnectionProviderManager
- implements org.apache.avalon.framework.activity.Disposable, org.apache.avalon.framework.configuration.Configurable
Implementation of ConnectionProviderManager
that provides ConnectionProvider
s
which pool the connections.
The pooling strategy is optimized for the case where there are hundreds of ConnectionProviders
(thus hundreds of pools) which are sometimes used intensively and then long times not at all.
Obviously in this case we don't want each pool to maintain a minimum number of connections, since
otherwise there would constantly be hundreds of connections (to different databases), only a few of
which are actually used. Therefore, a management thread will clean up all the connections that are not
used for a certain amount of time (by default half an hour). Thus the minimum size of a pool is always
zero. The maximum size is currenlty unlimmited.
A specific feature of this pool that is not found in common connection-pool implementations is that all the pools
are managed by one thread, instead of a separate thread for each pool.
Methods inherited from class org.apache.avalon.framework.logger.AbstractLogEnabled |
enableLogging, getLogger, setupLogger, setupLogger, setupLogger |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
providers
protected java.util.ArrayList providers
managementThreadIntervalMs
protected int managementThreadIntervalMs
maxConnectionInactiveTime
protected int maxConnectionInactiveTime
managementThread
protected org.outerj.xreporter.connectionprovider.pooling.PoolingConnectionProviderManager.ManagementThread managementThread
CONNECTION_PROVIDERS_EL
protected static final java.lang.String CONNECTION_PROVIDERS_EL
- See Also:
- Constant Field Values
CONNECTION_PROVIDER_EL
protected static final java.lang.String CONNECTION_PROVIDER_EL
- See Also:
- Constant Field Values
CONNECTIONS_IN_USE_COUNT_ATT
protected static final java.lang.String CONNECTIONS_IN_USE_COUNT_ATT
- See Also:
- Constant Field Values
CONNECTIONS_AVAILABLE_COUNT_ATT
protected static final java.lang.String CONNECTIONS_AVAILABLE_COUNT_ATT
- See Also:
- Constant Field Values
DESCRIPTION_ATT
protected static final java.lang.String DESCRIPTION_ATT
- See Also:
- Constant Field Values
PoolingConnectionProviderManager
public PoolingConnectionProviderManager()
createProvider
public ConnectionProvider createProvider(java.util.Properties properties)
- Description copied from interface:
ConnectionProviderManager
- The properties should contain the properties used to create the connection.
It should at least contain "url", and usually also "user" and "password".
This method will always return new instances, even if you call it twice with the
same properties. It is the responsiblity of the caller to keep a reference to
the created ConnectionProvider. Depending on the implementation, ConnectionProviderManager
itself could also keep references to the ConnectionProviders for maintenance purposes.
- Specified by:
createProvider
in interface ConnectionProviderManager
configure
public void configure(org.apache.avalon.framework.configuration.Configuration configuration)
throws org.apache.avalon.framework.configuration.ConfigurationException
- Specified by:
configure
in interface org.apache.avalon.framework.configuration.Configurable
- Overrides:
configure
in class AbstractConnectionProviderManager
- Throws:
org.apache.avalon.framework.configuration.ConfigurationException
initialize
public void initialize()
throws java.lang.Exception
- Specified by:
initialize
in interface org.apache.avalon.framework.activity.Initializable
- Overrides:
initialize
in class AbstractConnectionProviderManager
- Throws:
java.lang.Exception
dispose
public void dispose()
- Specified by:
dispose
in interface org.apache.avalon.framework.activity.Disposable
removeProvider
protected void removeProvider(PoolingConnectionProvider provider)
getMaxConnectionInactiveTime
public int getMaxConnectionInactiveTime()
generateStatus
public void generateStatus(org.xml.sax.ContentHandler contentHandler)
throws org.xml.sax.SAXException
- Description copied from interface:
ConnectionProviderManager
- Generates some status information such as pool sizes.
- Specified by:
generateStatus
in interface ConnectionProviderManager
- Throws:
org.xml.sax.SAXException