commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Bernie McGourty (JIRA)" <j...@apache.org>
Subject [jira] Created: (POOL-87) Commons-Pool does not always calling activateObject on newly created Objects
Date Wed, 11 Oct 2006 19:01:35 GMT
Commons-Pool does not always calling activateObject on newly created Objects
----------------------------------------------------------------------------

                 Key: POOL-87
                 URL: http://issues.apache.org/jira/browse/POOL-87
             Project: Commons Pool
          Issue Type: Bug
         Environment: Windows 2003 Java HotSpot(TM) Client VM (build 1.5.0_08-b03, mixed mode,
sharing)
            Reporter: Bernie McGourty


I'm using the GenericObjectPool and a PoolableObjectFactory.

The GenericObjectPool works as expected and documented in that my implementation of the PoolableObjectFactory
is called according to the life-cycle:

1. makeObject is called whenever a new instance is needed. 
2. activateObject is invoked on every instance before it is returned from the pool. 
3. passivateObject is invoked on every instance when it is returned to the pool. 
4. destroyObject is invoked on every instance when it is being "dropped" from the pool (whether
due to the response from validateObject, or for reasons specific to the pool implementation.)
5. validateObject is invoked in an implementation-specific fashion to determine if an instance
is still valid to be returned by the pool. It will only be invoked on an "activated" instance.


I've set the minimum idle instances to 5 and when the pool goes below 5 instances, new objects
are created to reach the minimum. 

The problem is that the life-cycle is not followed in that makeObject is called on the PoolFactory
and then validateObject - activateObject is never called. 

The interface doc for validateObject stipulates that it will only be invoked on "activated"
objects.

I looked at the GenericObjectPool class and it appears that ensureMinIdle() creates the new
objects required by calling addObject() but when it calls addObjectToPool() the newly created
object is never activated before it is validated.

I'm using the following pool config:

poolConfig.maxWait        = 5000;
poolConfig.maxActive      = 100;
poolConfig.minIdle        = 5;
poolConfig.maxIdle        = 50;
poolConfig.testOnBorrow   = true;
poolConfig.testOnReturn   = true;
poolConfig.testWhileIdle  = true;
poolConfig.timeBetweenEvictionRunsMillis  = 15000; poolConfig.whenExhaustedAction = GenericObjectPool.WHEN_EXHAUSTED_GROW;


-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org


Mime
View raw message