BF: [ 2459542 ] Synchronize singletons

https://sourceforge.net/tracker/index.php?func=detail&aid=2459542&group_id=176962&atid=955896

Adempiere has several singleton classes which are not safe and must be synchronized.
Suggestion is to synchronize get methods in order to avoid concurrency issues.
This commit is contained in:
trifonnt 2008-12-23 11:33:21 +00:00
parent 626a72ee5d
commit 95fc42571b
4 changed files with 7 additions and 7 deletions

View File

@ -33,7 +33,7 @@ public class CLogFilter implements Filter
* Get Filter * Get Filter
* @return singleton * @return singleton
*/ */
public static CLogFilter get() public static synchronized CLogFilter get()
{ {
if (s_filter == null) if (s_filter == null)
s_filter = new CLogFilter(); s_filter = new CLogFilter();

View File

@ -38,7 +38,7 @@ public class CLogFormatter extends Formatter
* Get Formatter * Get Formatter
* @return singleton * @return singleton
*/ */
public static CLogFormatter get() public static synchronized CLogFormatter get()
{ {
if (s_formatter == null) if (s_formatter == null)
s_formatter = new CLogFormatter(); s_formatter = new CLogFormatter();

View File

@ -19,7 +19,7 @@ package org.compiere.util;
import java.util.ArrayList; import java.util.ArrayList;
/** /**
* Adempiere Cache Manangement * Adempiere Cache Management
* *
* @author Jorg Janke * @author Jorg Janke
* @version $Id: CacheMgt.java,v 1.2 2006/07/30 00:54:35 jjanke Exp $ * @version $Id: CacheMgt.java,v 1.2 2006/07/30 00:54:35 jjanke Exp $
@ -28,9 +28,9 @@ public class CacheMgt
{ {
/** /**
* Get Cache Management * Get Cache Management
* @return Cache Mgr * @return Cache Manager
*/ */
public static CacheMgt get() public static synchronized CacheMgt get()
{ {
if (s_cache == null) if (s_cache == null)
s_cache = new CacheMgt(); s_cache = new CacheMgt();

View File

@ -48,9 +48,9 @@ public final class Msg
/** /**
* Get Message Object * Get Message Object
* @return Mag * @return Msg
*/ */
private static Msg get() private static synchronized Msg get()
{ {
if (s_msg == null) if (s_msg == null)
s_msg = new Msg(); s_msg = new Msg();