commons-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Phil Steitz (JIRA)" <j...@apache.org>
Subject [jira] Commented: (POOL-150) GenericKeyedObjectPool.preparePool does not throw an exception if supplied factory is null
Date Tue, 21 Dec 2010 17:46:03 GMT

    [ https://issues.apache.org/jira/browse/POOL-150?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12973788#action_12973788
] 

Phil Steitz commented on POOL-150:
----------------------------------

Based on current 2.0 code in trunk, I would say we can resolve this as fixed in 2.0, since
null factories are not allowed by ctors and we are removing the setter.  I will note, however,
at this point that the latter causes problems for DBCP [1] and Tomcat, so maybe we should
leave this open until we have a workaround in place at least for DBCP and we are closer to
2.0 release.

[1] See the constructor for PoolableConnectionFactory and the createConnectionPool, createPoolableConnectionFactory
methods in BasicDataSource.  The strategy used by DBCP is to create the pool, set its properties
(other than the factory) and then attach the factory to the pool in the factory constructor.
 Should be able to be refactored, but maybe best to leave this open until we have done that.




> GenericKeyedObjectPool.preparePool does not throw an exception if supplied factory is
null
> ------------------------------------------------------------------------------------------
>
>                 Key: POOL-150
>                 URL: https://issues.apache.org/jira/browse/POOL-150
>             Project: Commons Pool
>          Issue Type: Bug
>    Affects Versions: 1.4
>         Environment: Java 5
>            Reporter: VIJAY KUMAR
>             Fix For: 2.0
>
>   Original Estimate: 3h
>  Remaining Estimate: 3h
>
> GenericKeyedObjectPool.preparePool  doesnot throw an exception if supplied factory is
null. 
> GenericKeyedObjectPool.preparePool invokes ensureMinIdle() if populateImmediately is
true and GenericKeyedObjectPool.ensureMinIdle() invokes GenericKeyedObjectPool.addObject()
which throws an IllegalStateException if factory is null but this exception does not throw
further in GenericKeyedObjectPool.preparePool.
> Catch block of  GenericKeyedObjectPool..preparePool is empty.
> public synchronized void preparePool(Object key, boolean populateImmediately) {
>     	ObjectQueue pool = (ObjectQueue)(_poolMap.get(key));
>     	System.out.println(this.getClass().getName()+".preparePool() pool  ["+pool +"]");
>         if (null == pool) {
>             pool = new ObjectQueue();
>             _poolMap.put(key,pool);
>             _poolList.add(key);
>         }
>         if (populateImmediately) {
>             try {
>                 // Create the pooled objects
>             	System.out.println(this.getClass().getName()+".preparePool() Create the
pooled objects ");
>                 ensureMinIdle(key);
>             }
>             catch (Exception e) {
>                 //Do nothing
>             }
>         }
>     }

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


Mime
View raw message