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-unsubscr...@commons.apache.org
> For additional commands, e-mail: dev-h...@commons.apache.org
> 


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

Reply via email to