org.apache.avalon.excalibur.datasource
Class ResourceLimitingJdbcConnectionPool

java.lang.Object
  |
  +--org.apache.avalon.framework.logger.AbstractLogEnabled
        |
        +--org.apache.avalon.excalibur.pool.ResourceLimitingPool
              |
              +--org.apache.avalon.excalibur.pool.ValidatedResourceLimitingPool
                    |
                    +--org.apache.avalon.excalibur.datasource.ResourceLimitingJdbcConnectionPool
All Implemented Interfaces:
org.apache.avalon.framework.component.Component, org.apache.avalon.framework.activity.Disposable, org.apache.avalon.framework.logger.LogEnabled, Pool, org.apache.avalon.framework.thread.ThreadSafe

public class ResourceLimitingJdbcConnectionPool
extends ValidatedResourceLimitingPool

A ResourceLimiting JdbcConnectionPool which allows for fine configuration of how the pool scales to loads. The pool supports; weak and strong pool size limits, optional blocking gets when connections are not available, and automatic trimming of unused connections.

Since:
4.1
Version:
CVS $Revision: 1.2 $ $Date: 2002/01/25 01:24:27 $
Author:
Leif Mortenson

Fields inherited from class org.apache.avalon.excalibur.pool.ResourceLimitingPool
m_semaphore
 
Constructor Summary
ResourceLimitingJdbcConnectionPool(ObjectFactory factory, int max, boolean maxStrict, boolean blocking, long blockTimeout, long trimInterval, boolean autoCommit)
          Creates a new ResourceLimitingJdbcConnectionPool
 
Method Summary
protected  Poolable newPoolable()
          Create a new poolable instance by by calling the newInstance method on the pool's ObjectFactory.
protected  boolean validatePoolable(Poolable poolable)
          Validates the poolable before it is provided to the caller of get on this pool.
 
Methods inherited from class org.apache.avalon.excalibur.pool.ValidatedResourceLimitingPool
get
 
Methods inherited from class org.apache.avalon.excalibur.pool.ResourceLimitingPool
dispose, getReadySize, getSize, permanentlyRemovePoolable, put, removePoolable, trim
 
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
 
Methods inherited from interface org.apache.avalon.framework.logger.LogEnabled
enableLogging
 

Constructor Detail

ResourceLimitingJdbcConnectionPool

public ResourceLimitingJdbcConnectionPool(ObjectFactory factory,
                                          int max,
                                          boolean maxStrict,
                                          boolean blocking,
                                          long blockTimeout,
                                          long trimInterval,
                                          boolean autoCommit)
Creates a new ResourceLimitingJdbcConnectionPool
Parameters:
factory - The ObjectFactory which will be used to create new connections as needed by the pool.
max - Maximum number of connections which can be stored in the pool, 0 implies no limit.
maxStrict - true if the pool should never allow more than max connections to be created. Will cause an exception to be thrown if more than max connections are requested and blocking is false.
blocking - true if the pool should cause a thread calling get() to block when connections are not currently available in the pool.
blockTimeout - The maximum amount of time, in milliseconds, that a call to get() will block before an exception is thrown. A value of 0 implies an indefinate wait.
trimInterval - The minimum interval with which old unused connections will be removed from the pool. A value of 0 will cause the pool to never trim old connections.
autoCommit - true if connections created by this pool should have autoCommit enabled.
Method Detail

newPoolable

protected Poolable newPoolable()
                        throws java.lang.Exception
Create a new poolable instance by by calling the newInstance method on the pool's ObjectFactory. This is the method to override when you need to enforce creational policies. This method is only called by threads that have _semaphore locked.
Overrides:
newPoolable in class ValidatedResourceLimitingPool

validatePoolable

protected boolean validatePoolable(Poolable poolable)
Validates the poolable before it is provided to the caller of get on this pool. This implementation of the validation method always returns true indicating that the Poolable is valid. The pool is not locked by the current thread when this method is called.
Overrides:
validatePoolable in class ValidatedResourceLimitingPool
Parameters:
poolable - The Poolable to be validated


Copyright © 2001 Apache Jakarta Project. All Rights Reserved.