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

Sebb commented on POOL-225:
---------------------------

I've just run FindBugs, and it reports:

Inconsistent synchronization of 
org.apache.commons.pool.impl.GenericKeyedObjectPool._factoryClassLoader; locked 
50% of time
Inconsistent synchronization of 
org.apache.commons.pool.impl.GenericObjectPool._factoryClassLoader; locked 50% 
of time

I'm not sure why these are not bugs.
The _factoryClassLoader field is accessed without sync by the Evictor, which is 
a TimerTask.
The field _factoryClassLoader is set by the ctor, which is before the Evictor 
is created and started, so the value will be published OK, even though it is 
not sync. or volatile.

However, the method setFactory() also updates the field; if this is invoked 
after the TimerTask is created, then there may be a data publication issue, 
because one thread is setting a value that is read by another.

What I don't understand is why the setFactory() method actually sets 
_factoryClassLoader, as it has been set already by the ctor using identical 
code. If the re-setting of the field is removed from setFactory() then the 
field can be made final. FindBugs no longer complains if this is done.

                
> Changes to findbugs-exclude-filter.xml to eliminate false alerts on Evictor 
> classes
> -----------------------------------------------------------------------------------
>
>                 Key: POOL-225
>                 URL: https://issues.apache.org/jira/browse/POOL-225
>             Project: Commons Pool
>          Issue Type: Improvement
>    Affects Versions: 1.6
>            Reporter: Liviu Tudor
>            Priority: Trivial
>              Labels: findbugs
>             Fix For: 1.6.1
>
>         Attachments: POOL-225.2.patch, POOL-225.patch.bz2
>
>   Original Estimate: 0.25h
>  Remaining Estimate: 0.25h
>
> For both {{GenericKeyedObjectPool}} and {{GenericObjectPool}}, FindBugs 
> signals an inconsistent sycnhronization warning ({{IS2_INCONSISTENT_SYNC}}) 
> however it turns out it's a false alert.
> Talking to [pool] developers, the general consensus was to update 
> {{findbugs-exclude-filter.xml}} to exclude these 2 checks, hence this ticket.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: 
https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

Reply via email to