Browse files

Make unsynchronized LoggerFactory field syncronized

Because the compiler or processor may reorder instructions, threads
are not guaranteed to see a completely initialized object if the
init function is called by two different threads.

Change-Id: I33342891fe098f84791bf8358e82f31a4bc99d92
Reviewed-by: Matt Ingenthron <>
Tested-by: Michael Wiederhold <>
  • Loading branch information...
mikewied committed Sep 26, 2012
1 parent 388fd0e commit d584446c647b89f0bb433fea43fbe983a709aee1
Showing with 1 addition and 1 deletion.
  1. +1 −1 src/main/java/net/spy/memcached/compat/log/
@@ -44,7 +44,7 @@
public final class LoggerFactory extends Object {
- private static LoggerFactory instance = null;
+ private static volatile LoggerFactory instance = null;
private final ConcurrentMap<String, Logger> instances;
private Constructor<? extends Logger> instanceConstructor;

0 comments on commit d584446

Please sign in to comment.