openjpa-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From kwsut...@apache.org
Subject svn commit: r1307916 - in /openjpa/trunk/openjpa-kernel/src/main/java/org/apache/openjpa: event/LifecycleEventManager.java kernel/BrokerImpl.java validation/ValidatingLifecycleEventManager.java
Date Sat, 31 Mar 2012 21:57:23 GMT
Author: kwsutter
Date: Sat Mar 31 21:57:22 2012
New Revision: 1307916

URL: http://svn.apache.org/viewvc?rev=1307916&view=rev
Log:
OPENJPA-2168.  Move call to check for existing Listeners higher in the call stack.

Modified:
    openjpa/trunk/openjpa-kernel/src/main/java/org/apache/openjpa/event/LifecycleEventManager.java
    openjpa/trunk/openjpa-kernel/src/main/java/org/apache/openjpa/kernel/BrokerImpl.java
    openjpa/trunk/openjpa-kernel/src/main/java/org/apache/openjpa/validation/ValidatingLifecycleEventManager.java

Modified: openjpa/trunk/openjpa-kernel/src/main/java/org/apache/openjpa/event/LifecycleEventManager.java
URL: http://svn.apache.org/viewvc/openjpa/trunk/openjpa-kernel/src/main/java/org/apache/openjpa/event/LifecycleEventManager.java?rev=1307916&r1=1307915&r2=1307916&view=diff
==============================================================================
--- openjpa/trunk/openjpa-kernel/src/main/java/org/apache/openjpa/event/LifecycleEventManager.java
(original)
+++ openjpa/trunk/openjpa-kernel/src/main/java/org/apache/openjpa/event/LifecycleEventManager.java
Sat Mar 31 21:57:22 2012
@@ -209,7 +209,7 @@ public class LifecycleEventManager
             || hasHandlers(source, meta, LifecycleEvent.AFTER_ATTACH);
     }
 
-    private boolean hasHandlers(Object source, ClassMetaData meta, int type) {
+    public boolean hasHandlers(Object source, ClassMetaData meta, int type) {
         return hasCallbacks(source, meta, type)
             || hasListeners(source, meta, type);
     }

Modified: openjpa/trunk/openjpa-kernel/src/main/java/org/apache/openjpa/kernel/BrokerImpl.java
URL: http://svn.apache.org/viewvc/openjpa/trunk/openjpa-kernel/src/main/java/org/apache/openjpa/kernel/BrokerImpl.java?rev=1307916&r1=1307915&r2=1307916&view=diff
==============================================================================
--- openjpa/trunk/openjpa-kernel/src/main/java/org/apache/openjpa/kernel/BrokerImpl.java (original)
+++ openjpa/trunk/openjpa-kernel/src/main/java/org/apache/openjpa/kernel/BrokerImpl.java Sat
Mar 31 21:57:22 2012
@@ -793,6 +793,8 @@ public class BrokerImpl
         int eventType) {
         if (_lifeEventManager == null)
             return false;
+        if (!_lifeEventManager.hasHandlers(src, meta, eventType))
+            return false;
 
         lock();
         Exception[] exs;

Modified: openjpa/trunk/openjpa-kernel/src/main/java/org/apache/openjpa/validation/ValidatingLifecycleEventManager.java
URL: http://svn.apache.org/viewvc/openjpa/trunk/openjpa-kernel/src/main/java/org/apache/openjpa/validation/ValidatingLifecycleEventManager.java?rev=1307916&r1=1307915&r2=1307916&view=diff
==============================================================================
--- openjpa/trunk/openjpa-kernel/src/main/java/org/apache/openjpa/validation/ValidatingLifecycleEventManager.java
(original)
+++ openjpa/trunk/openjpa-kernel/src/main/java/org/apache/openjpa/validation/ValidatingLifecycleEventManager.java
Sat Mar 31 21:57:22 2012
@@ -97,6 +97,14 @@ public class ValidatingLifecycleEventMan
         return _validator.validating(source, LifecycleEvent.BEFORE_DELETE) ||
             super.hasDeleteListeners(source, meta);
     }
+    
+    @Override
+    public boolean hasHandlers(Object source, ClassMetaData meta, int type) {
+        if (_validator == null) {            
+            return super.hasHandlers(source, meta, type);
+        }
+        return true;
+    }
 
     @Override
     public Exception[] fireEvent(Object source,



Mime
View raw message