commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Oliver Heger <oliver.he...@oliver-heger.de>
Subject [configuration] Checkstyle warning about double-checked locking in DynamicCombinedConfiguration
Date Sun, 29 Jul 2012 19:40:37 GMT
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


Mime
View raw message