From c3a69fd77d217b5fa4e6e8d290b0c64d41e45805 Mon Sep 17 00:00:00 2001 From: Otis Gospodnetic Date: Sun, 15 Sep 2002 00:26:21 +0000 Subject: [PATCH] - Made this singleton thread-safe. git-svn-id: https://svn.apache.org/repos/asf/lucene/java/trunk@150825 13f79535-47bb-0310-9956-ffa450edef68 --- .../lanlab/larm/util/SimpleLoggerManager.java | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/sandbox/contributions/webcrawler-LARM/src/de/lanlab/larm/util/SimpleLoggerManager.java b/sandbox/contributions/webcrawler-LARM/src/de/lanlab/larm/util/SimpleLoggerManager.java index ec70a57045f..0c010d2fb3d 100644 --- a/sandbox/contributions/webcrawler-LARM/src/de/lanlab/larm/util/SimpleLoggerManager.java +++ b/sandbox/contributions/webcrawler-LARM/src/de/lanlab/larm/util/SimpleLoggerManager.java @@ -58,14 +58,15 @@ import java.util.*; import java.io.IOException; /** - * this singleton manages all loggers. It can be used to flush all SimpleLoggers - * at once + * This singleton manages all loggers. It can be used to flush all SimpleLoggers + * at once. + * @version $Id$ */ public class SimpleLoggerManager { - static SimpleLoggerManager instance = null; + private static SimpleLoggerManager instance = null; - ArrayList logs; + private ArrayList logs; private SimpleLoggerManager() { @@ -93,18 +94,18 @@ public class SimpleLoggerManager ex = e; } } - if(ex != null) + if (ex != null) { throw ex; } } - public static SimpleLoggerManager getInstance() + public synchronized static SimpleLoggerManager getInstance() { - if(instance == null) + if (instance == null) { instance = new SimpleLoggerManager(); } return instance; } -} \ No newline at end of file +}