Author: lektran
Date: Sat Dec 12 10:50:28 2009
New Revision: 889919

URL: http://svn.apache.org/viewvc?rev=889919&view=rev
Log:
I noticed during test runs that the same eca rules are being checked multiple 
times, this is because the test run loads multiple dispatchers with each 
calling ServiceEcaUtil.readConfig() which blindly adds the rules to each cache 
entry regardless of whether they are already present or not.

Modified:
    ofbiz/trunk/framework/service/src/org/ofbiz/service/eca/ServiceEcaUtil.java

Modified: 
ofbiz/trunk/framework/service/src/org/ofbiz/service/eca/ServiceEcaUtil.java
URL: 
http://svn.apache.org/viewvc/ofbiz/trunk/framework/service/src/org/ofbiz/service/eca/ServiceEcaUtil.java?rev=889919&r1=889918&r2=889919&view=diff
==============================================================================
--- ofbiz/trunk/framework/service/src/org/ofbiz/service/eca/ServiceEcaUtil.java 
(original)
+++ ofbiz/trunk/framework/service/src/org/ofbiz/service/eca/ServiceEcaUtil.java 
Sat Dec 12 10:50:28 2009
@@ -57,6 +57,10 @@
     }
 
     public static void readConfig() {
+        // Only proceed if the cache hasn't already been populated, caller 
should be using reloadConfig() in that situation
+        if (UtilValidate.isNotEmpty(ecaCache)) {
+            return;
+        }
         Element rootElement = null;
         try {
             rootElement = ServiceConfigUtil.getXmlRootElement();


Reply via email to