Please revert this. Double-checked locking is thread-safe so long as the variable is declared volatile.
Ralph On Apr 3, 2014, at 4:20 PM, [email protected] wrote: > Author: mattsicker > Date: Thu Apr 3 23:20:32 2014 > New Revision: 1584462 > > URL: http://svn.apache.org/r1584462 > Log: > Add note to fix double-checked locking. > > Modified: > > logging/log4j/log4j2/trunk/log4j-core/src/main/java/org/apache/logging/log4j/core/config/ConfigurationFactory.java > > Modified: > logging/log4j/log4j2/trunk/log4j-core/src/main/java/org/apache/logging/log4j/core/config/ConfigurationFactory.java > URL: > http://svn.apache.org/viewvc/logging/log4j/log4j2/trunk/log4j-core/src/main/java/org/apache/logging/log4j/core/config/ConfigurationFactory.java?rev=1584462&r1=1584461&r2=1584462&view=diff > ============================================================================== > --- > logging/log4j/log4j2/trunk/log4j-core/src/main/java/org/apache/logging/log4j/core/config/ConfigurationFactory.java > (original) > +++ > logging/log4j/log4j2/trunk/log4j-core/src/main/java/org/apache/logging/log4j/core/config/ConfigurationFactory.java > Thu Apr 3 23:20:32 2014 > @@ -112,6 +112,8 @@ public abstract class ConfigurationFacto > * @return the ConfigurationFactory. > */ > public static ConfigurationFactory getInstance() { > + // FIXME: double-checked locking is unsafe > + // > http://www.cs.umd.edu/~pugh/java/memoryModel/DoubleCheckedLocking.html > if (factories == null) { > synchronized(TEST_PREFIX) { > if (factories == null) { > > --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
