Author: jaz
Date: Tue May 8 20:34:44 2007
New Revision: 536399
URL:
http://svn.apache.org/viewvc?view=rev&rev=536399Log:
fixed LRU synchronization issues
Modified:
ofbiz/trunk/framework/service/src/org/ofbiz/service/ServiceDispatcher.java
Modified: ofbiz/trunk/framework/service/src/org/ofbiz/service/ServiceDispatcher.java
URL:
http://svn.apache.org/viewvc/ofbiz/trunk/framework/service/src/org/ofbiz/service/ServiceDispatcher.java?view=diff&rev=536399&r1=536398&r2=536399==============================================================================
--- ofbiz/trunk/framework/service/src/org/ofbiz/service/ServiceDispatcher.java (original)
+++ ofbiz/trunk/framework/service/src/org/ofbiz/service/ServiceDispatcher.java Tue May 8 20:34:44 2007
@@ -62,7 +62,7 @@
public static final String module = ServiceDispatcher.class.getName();
public static final int lruLogSize = 200;
- protected static Map runLog = new LRUMap(lruLogSize);
+ protected static final Map runLog = new LRUMap(lruLogSize);
protected static Map dispatchers = FastMap.newInstance();
protected static boolean enableJM = true;
protected static boolean enableJMS = true;
@@ -904,17 +904,20 @@
// set up the running service log
RunningService rs = new RunningService(localName, modelService, mode);
if (runLog == null) {
- runLog = new LRUMap(lruLogSize);
- }
- try {
- runLog.put(rs, this);
- } catch (Throwable t) {
- Debug.logWarning("LRUMap problem; resetting LRU [" + runLog.size() + "]", module);
- runLog = new LRUMap(lruLogSize);
- try {
- runLog.put(rs, this);
- } catch (Throwable t2) {
- Debug.logError(t2, "Unable to put() in reset LRU map!", module);
+ Debug.logWarning("LRUMap is null", module);
+ } else {
+ synchronized(runLog) {
+ try {
+ runLog.put(rs, this);
+ } catch (Throwable t) {
+ Debug.logWarning("LRUMap problem; resetting LRU [" + runLog.size() + "]", module);
+ runLog.clear();
+ try {
+ runLog.put(rs, this);
+ } catch (Throwable t2) {
+ Debug.logError(t2, "Unable to put() in reset LRU map!", module);
+ }
+ }
}
}
return rs;