You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ofbiz.apache.org by do...@apache.org on 2013/05/13 20:01:54 UTC

svn commit: r1482002 - /ofbiz/trunk/framework/entity/src/org/ofbiz/entity/GenericDelegator.java

Author: doogie
Date: Mon May 13 18:01:54 2013
New Revision: 1482002

URL: http://svn.apache.org/r1482002
Log:
FEATURE: When there is no configured eca handler configured, only print
out the warning once, instead of on every single call.  This actually
gives a rather impressive performance improvement.

Modified:
    ofbiz/trunk/framework/entity/src/org/ofbiz/entity/GenericDelegator.java

Modified: ofbiz/trunk/framework/entity/src/org/ofbiz/entity/GenericDelegator.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/entity/src/org/ofbiz/entity/GenericDelegator.java?rev=1482002&r1=1482001&r2=1482002&view=diff
==============================================================================
--- ofbiz/trunk/framework/entity/src/org/ofbiz/entity/GenericDelegator.java (original)
+++ ofbiz/trunk/framework/entity/src/org/ofbiz/entity/GenericDelegator.java Mon May 13 18:01:54 2013
@@ -103,6 +103,7 @@ public class GenericDelegator implements
     protected Cache cache = null;
 
     protected DistributedCacheClear distributedCacheClear = null;
+    protected boolean warnNoEcaHandler = false;
     protected EntityEcaHandler<?> entityEcaHandler = null;
     protected SequenceUtil sequencer = null;
     protected EntityCrypto crypto = null;
@@ -310,7 +311,7 @@ public class GenericDelegator implements
      */
     public synchronized void initEntityEcaHandler() {
         // Nothing to do if already assigned: the class loader has already been called, the class instantiated and casted to EntityEcaHandler
-        if (this.entityEcaHandler != null) {
+        if (this.entityEcaHandler != null || this.warnNoEcaHandler) {
             return;
         }
         // If useEntityEca is false do nothing: the entityEcaHandler member field with a null value would cause its code to do nothing
@@ -333,8 +334,9 @@ public class GenericDelegator implements
             } catch (ClassCastException e) {
                 Debug.logWarning(e, "EntityEcaHandler class with name " + entityEcaHandlerClassName + " does not implement the EntityEcaHandler interface, Entity ECA Rules will be disabled", module);
             }
-        } else {
+        } else if (!this.warnNoEcaHandler) {
             Debug.logInfo("Entity ECA Handler disabled for delegator [" + delegatorFullName + "]", module);
+            this.warnNoEcaHandler = true;
         }
     }
 
@@ -2422,6 +2424,7 @@ public class GenericDelegator implements
      */
     public <T> void setEntityEcaHandler(EntityEcaHandler<T> entityEcaHandler) {
         this.entityEcaHandler = entityEcaHandler;
+        this.warnNoEcaHandler = false;
     }
 
     /* (non-Javadoc)