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

Jacopo Cappellato commented on POOL-279:
----------------------------------------

[[email protected]] I can definitely refine the code in the tests: it is a 
result of a few attempts to recreate consistently the issue and I know it is 
not perfect. In particular, the return statements are not necessary but I have 
added them to terminate earlier the test if the error condition is met. However 
I didn't want to check the negativeIdleTimeReturned condition too often because 
this would increase the serialization of threads. But, especially if you are 
willing to commit the test in the trunk, I would be happy to clean it a bit.

As regards the fix: I agree that your simplified code is better.


> Thread concurrency issue in DefaultPooledObject.getIdleTimeMillis()
> -------------------------------------------------------------------
>
>                 Key: POOL-279
>                 URL: https://issues.apache.org/jira/browse/POOL-279
>             Project: Commons Pool
>          Issue Type: Bug
>    Affects Versions: 2.2
>            Reporter: Jacopo Cappellato
>            Priority: Minor
>         Attachments: POOL-279-unit-test.patch, POOL-279.patch, 
> POOL-279.patch, POOL-279.patch, POOL-279.patch
>
>
> Under unlucky thread concurrency the getIdleTimeMillis() method of 
> DefaultPooledObject can return a negative value.
> I have attached a Junit test that fails most of the times and a simple fix, 
> that doesn't use synchronization: with this fix the Junit test always succeed.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to