You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@commons.apache.org by "David Hu (JIRA)" <ji...@apache.org> on 2010/01/27 00:39:34 UTC
[jira] Created: (POOL-157) GenericObjectPool.setFactory(...) does
not destroy idle pool objects with their original factory object.
GenericObjectPool.setFactory(...) does not destroy idle pool objects with their original factory object.
--------------------------------------------------------------------------------------------------------
Key: POOL-157
URL: https://issues.apache.org/jira/browse/POOL-157
Project: Commons Pool
Issue Type: Bug
Reporter: David Hu
Priority: Minor
When setting a new object factory, the existing idle poolable objects are not destroyed by the same factory that created them.
1453 public void setFactory(PoolableObjectFactory factory) throws IllegalStateException {
1454 List toDestroy = new ArrayList();
1455 synchronized (this) {
1456 assertOpen();
1457 if(0 < getNumActive()) {
1458 throw new IllegalStateException("Objects are already active");
1459 } else {
1460 toDestroy.addAll(_pool);
1461 _numInternalProcessing = _numInternalProcessing + _pool._size;
1462 _pool.clear();
1463 }
1464 _factory = factory;
1465 }
1466 destroy(toDestroy); // <----- indirectly calls _factory.destroy(...) when _factory has already been replaced by the new factory.
1467 }
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
[jira] Commented: (POOL-157) GenericObjectPool.setFactory(...) does
not destroy idle pool objects with their original factory object.
Posted by "David Hu (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/POOL-157?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12832233#action_12832233 ]
David Hu commented on POOL-157:
-------------------------------
I have no use case for it. I just noticed it while trying to understand the code.
> GenericObjectPool.setFactory(...) does not destroy idle pool objects with their original factory object.
> --------------------------------------------------------------------------------------------------------
>
> Key: POOL-157
> URL: https://issues.apache.org/jira/browse/POOL-157
> Project: Commons Pool
> Issue Type: Bug
> Reporter: David Hu
> Priority: Minor
>
> When setting a new object factory, the existing idle poolable objects are not destroyed by the same factory that created them.
> 1453 public void setFactory(PoolableObjectFactory factory) throws IllegalStateException {
> 1454 List toDestroy = new ArrayList();
> 1455 synchronized (this) {
> 1456 assertOpen();
> 1457 if(0 < getNumActive()) {
> 1458 throw new IllegalStateException("Objects are already active");
> 1459 } else {
> 1460 toDestroy.addAll(_pool);
> 1461 _numInternalProcessing = _numInternalProcessing + _pool._size;
> 1462 _pool.clear();
> 1463 }
> 1464 _factory = factory;
> 1465 }
> 1466 destroy(toDestroy); // <----- indirectly calls _factory.destroy(...) when _factory has already been replaced by the new factory.
> 1467 }
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
[jira] Commented: (POOL-157) GenericObjectPool.setFactory(...) does
not destroy idle pool objects with their original factory object.
Posted by "Phil Steitz (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/POOL-157?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12832243#action_12832243 ]
Phil Steitz commented on POOL-157:
----------------------------------
OK. Thanks for reporting this issue.
> GenericObjectPool.setFactory(...) does not destroy idle pool objects with their original factory object.
> --------------------------------------------------------------------------------------------------------
>
> Key: POOL-157
> URL: https://issues.apache.org/jira/browse/POOL-157
> Project: Commons Pool
> Issue Type: Bug
> Reporter: David Hu
> Priority: Minor
>
> When setting a new object factory, the existing idle poolable objects are not destroyed by the same factory that created them.
> 1453 public void setFactory(PoolableObjectFactory factory) throws IllegalStateException {
> 1454 List toDestroy = new ArrayList();
> 1455 synchronized (this) {
> 1456 assertOpen();
> 1457 if(0 < getNumActive()) {
> 1458 throw new IllegalStateException("Objects are already active");
> 1459 } else {
> 1460 toDestroy.addAll(_pool);
> 1461 _numInternalProcessing = _numInternalProcessing + _pool._size;
> 1462 _pool.clear();
> 1463 }
> 1464 _factory = factory;
> 1465 }
> 1466 destroy(toDestroy); // <----- indirectly calls _factory.destroy(...) when _factory has already been replaced by the new factory.
> 1467 }
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
[jira] Resolved: (POOL-157) GenericObjectPool.setFactory(...) does
not destroy idle pool objects with their original factory object.
Posted by "Phil Steitz (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/POOL-157?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Phil Steitz resolved POOL-157.
------------------------------
Resolution: Fixed
Fixed in r932962.
> GenericObjectPool.setFactory(...) does not destroy idle pool objects with their original factory object.
> --------------------------------------------------------------------------------------------------------
>
> Key: POOL-157
> URL: https://issues.apache.org/jira/browse/POOL-157
> Project: Commons Pool
> Issue Type: Bug
> Affects Versions: 1.5, 1.5.1, 1.5.2, 1.5.3, 1.5.4
> Reporter: David Hu
> Priority: Minor
> Fix For: 1.5.5
>
>
> When setting a new object factory, the existing idle poolable objects are not destroyed by the same factory that created them.
> 1453 public void setFactory(PoolableObjectFactory factory) throws IllegalStateException {
> 1454 List toDestroy = new ArrayList();
> 1455 synchronized (this) {
> 1456 assertOpen();
> 1457 if(0 < getNumActive()) {
> 1458 throw new IllegalStateException("Objects are already active");
> 1459 } else {
> 1460 toDestroy.addAll(_pool);
> 1461 _numInternalProcessing = _numInternalProcessing + _pool._size;
> 1462 _pool.clear();
> 1463 }
> 1464 _factory = factory;
> 1465 }
> 1466 destroy(toDestroy); // <----- indirectly calls _factory.destroy(...) when _factory has already been replaced by the new factory.
> 1467 }
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: https://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira
[jira] Commented: (POOL-157) GenericObjectPool.setFactory(...) does
not destroy idle pool objects with their original factory object.
Posted by "Phil Steitz (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/POOL-157?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12831981#action_12831981 ]
Phil Steitz commented on POOL-157:
----------------------------------
This is the result of the change in pool 1.5 to move factory methods outside of synchronized scope to avoid deadlocks. The obvious fix for this would be to move the call to destroy above the factory reassignment. This would, however, violate the lock order principle above.
I am curious as to the use case for resetting the factory on an active pool. Why not just close the pool and create a new one with the new factory? Personally, I have always thought that the factory should be an immutable property of the pool. I am interested in the understanding the use case.
I propose to resolve this by
* deprecating the setter - to be removed in 2.0
* adding private destroy(PoolableObjectFactory, Collection) and passing it the old factory
> GenericObjectPool.setFactory(...) does not destroy idle pool objects with their original factory object.
> --------------------------------------------------------------------------------------------------------
>
> Key: POOL-157
> URL: https://issues.apache.org/jira/browse/POOL-157
> Project: Commons Pool
> Issue Type: Bug
> Reporter: David Hu
> Priority: Minor
>
> When setting a new object factory, the existing idle poolable objects are not destroyed by the same factory that created them.
> 1453 public void setFactory(PoolableObjectFactory factory) throws IllegalStateException {
> 1454 List toDestroy = new ArrayList();
> 1455 synchronized (this) {
> 1456 assertOpen();
> 1457 if(0 < getNumActive()) {
> 1458 throw new IllegalStateException("Objects are already active");
> 1459 } else {
> 1460 toDestroy.addAll(_pool);
> 1461 _numInternalProcessing = _numInternalProcessing + _pool._size;
> 1462 _pool.clear();
> 1463 }
> 1464 _factory = factory;
> 1465 }
> 1466 destroy(toDestroy); // <----- indirectly calls _factory.destroy(...) when _factory has already been replaced by the new factory.
> 1467 }
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
[jira] Updated: (POOL-157) GenericObjectPool.setFactory(...) does
not destroy idle pool objects with their original factory object.
Posted by "Phil Steitz (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/POOL-157?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Phil Steitz updated POOL-157:
-----------------------------
Fix Version/s: 1.5.5
Affects Version/s: 1.5.4
1.5.3
1.5.2
1.5.1
1.5
> GenericObjectPool.setFactory(...) does not destroy idle pool objects with their original factory object.
> --------------------------------------------------------------------------------------------------------
>
> Key: POOL-157
> URL: https://issues.apache.org/jira/browse/POOL-157
> Project: Commons Pool
> Issue Type: Bug
> Affects Versions: 1.5, 1.5.1, 1.5.2, 1.5.3, 1.5.4
> Reporter: David Hu
> Priority: Minor
> Fix For: 1.5.5
>
>
> When setting a new object factory, the existing idle poolable objects are not destroyed by the same factory that created them.
> 1453 public void setFactory(PoolableObjectFactory factory) throws IllegalStateException {
> 1454 List toDestroy = new ArrayList();
> 1455 synchronized (this) {
> 1456 assertOpen();
> 1457 if(0 < getNumActive()) {
> 1458 throw new IllegalStateException("Objects are already active");
> 1459 } else {
> 1460 toDestroy.addAll(_pool);
> 1461 _numInternalProcessing = _numInternalProcessing + _pool._size;
> 1462 _pool.clear();
> 1463 }
> 1464 _factory = factory;
> 1465 }
> 1466 destroy(toDestroy); // <----- indirectly calls _factory.destroy(...) when _factory has already been replaced by the new factory.
> 1467 }
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: https://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira