mirror of https://github.com/apache/lucene.git
- 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:
parent
e8dfbf2ace
commit
c3a69fd77d
|
@ -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;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue