- Made this singleton thread-safe.

git-svn-id: https://svn.apache.org/repos/asf/lucene/java/trunk@150825 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Otis Gospodnetic 2002-09-15 00:26:21 +00:00
parent e8dfbf2ace
commit c3a69fd77d
1 changed files with 9 additions and 8 deletions

View File

@ -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;
}
}
}