commons-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Mark Thomas (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (POOL-248) GenericObjectPool.returnObject() is NOT throwing IllegalStateException for object has already been returned
Date Wed, 29 Jan 2014 09:50:09 GMT

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

Mark Thomas commented on POOL-248:
----------------------------------

Confirmed. I've converted this to a unit test and am working on a fix now.

> GenericObjectPool.returnObject() is NOT throwing IllegalStateException for object has
already been returned
> -----------------------------------------------------------------------------------------------------------
>
>                 Key: POOL-248
>                 URL: https://issues.apache.org/jira/browse/POOL-248
>             Project: Commons Pool
>          Issue Type: Bug
>    Affects Versions: 2.1
>            Reporter: Warren Chen
>
> When GenericObjectPool is created using AbandonedConfig, the pool is NOT throwing "IllegalStateException:
Object has already been returned to this pool or is invalid" for object has already been returned.
> final GenericObjectPool<String> pool = new GenericObjectPool<String>(
> 				new SimpleFactory(), new GenericObjectPoolConfig(),
> 				new AbandonedConfig());
> 		String obj1 = pool.borrowObject();
> 		System.out.println("after borrowing obj1");
> 		System.out.println("numActive=" + pool.getNumActive());
> 		System.out.println("numIdle=" + pool.getNumIdle());
> 		System.out.println("return obj1");
> 		pool.returnObject(obj1);
> 		System.out.println("numActive=" + pool.getNumActive());
> 		System.out.println("numIdle=" + pool.getNumIdle());
> 		
> 		System.out.println("return obj1 again");
> 		pool.returnObject(obj1);
> 		System.out.println("numActive=" + pool.getNumActive());
> 		System.out.println("numIdle=" + pool.getNumIdle());
> Output:
> after borrowing obj1
> numActive=1
> numIdle=0
> return obj1
> numActive=0
> numIdle=1
> return obj1 again
> numActive=-1
> numIdle=2



--
This message was sent by Atlassian JIRA
(v6.1.5#6160)

Mime
View raw message