commons-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "William R. Speirs (Commented) (JIRA)" <>
Subject [jira] [Commented] (POOL-189) close() does not release threads blocked on borrowObject()
Date Mon, 14 Nov 2011 15:16:52 GMT


William R. Speirs commented on POOL-189:

Created a patch which I think fixes this issue. When the close() method is called it goes
through the _allocationQueue and notifies all of the waiting threads. Then in the barrowObject()
method, there is a check to see if the pool is closed after a waiting thread wakes. If so,
the thread throws an IllegalStateException with a message of "Pool closed".

I also included a unit test which tests this bug.

Note: I was working off /commons/proper/pool/branches/POOL_1_X as I couldn't find a branch
explicitly for 1.5.x code, and I figured trunk was 2.x code.
> close() does not release threads blocked on borrowObject()
> ----------------------------------------------------------
>                 Key: POOL-189
>                 URL:
>             Project: Commons Pool
>          Issue Type: Bug
>    Affects Versions: 1.5.6
>         Environment: java 1.6.0_24
>            Reporter: Adrian Nistor
>             Fix For: 1.5.7
>         Attachments: BUG-189v1.diff,
> Hi,
> When I call close() and borrowObject() concurrently with no objects in
> the pool, close() will finish but borrowObject() is blocked forever.
> The documentation of close() mentions that borrowObject() should fail 
> with IllegalStateException, so I would expect the waiting threads to 
> throw IllegalStateException.
> I will attach a test that exposes this problem. For this test, the 
> expected output is:
> 0
> 1
> 2
> ...
> 4999
> But when the bug manifests (almost always for this test), the output 
> is:
> 0
> 1
> 2
> The test does not finish, it just gets stuck after printing several 
> values.
> Is this a bug or am I reading the documentation wrongly? Is there 
> a patch for this?
> Thanks!
> Adrian

This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators:!default.jspa
For more information on JIRA, see:


View raw message