commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Ralph Goers <ralph.go...@dslextreme.com>
Subject Re: [configuration] Checkstyle warning about double-checked locking in DynamicCombinedConfiguration
Date Sun, 29 Jul 2012 20:41:12 GMT
I used that specifically to avoid creating multiple combined configurations since it can be
fairly expensive to create them.  I looked into the guarantees that ConcurrentMap provides
before I implemented that and included the comment since I knew it would catch someone's eye.
 

Ralph

On Jul 29, 2012, at 12:40 PM, Oliver Heger wrote:

> There is a checkstyle warning about double-checked locking in method DynamicCombinedConfiguration.getCurrentConfig().
Indeed, the double-check locking idiom is used, however, there is a comment saying that this
safe due to the usage of a ConcurrentMap.
> 
> This may be true, but I wonder whether it would be better to use the map's putIfAbsent()
method and avoid synchronization. The worst thing that can happen is that on parallel access
multiple CombinedConfiguration instances are created which can be passed immediately to the
garbage collector.
> 
> Thoughts?
> 
> Oliver
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@commons.apache.org
> For additional commands, e-mail: dev-help@commons.apache.org
> 


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@commons.apache.org
For additional commands, e-mail: dev-help@commons.apache.org


Mime
View raw message