Author: aadamchik
Date: Mon Jan 23 20:26:40 2012
New Revision: 1234971

URL: http://svn.apache.org/viewvc?rev=1234971&view=rev
Log:
CAY-957 Deadlock in nested contexts

preliminary refactoring, cleaning up duplicated code

Modified:
    
cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/event/DispatchQueue.java

Modified: 
cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/event/DispatchQueue.java
URL: 
http://svn.apache.org/viewvc/cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/event/DispatchQueue.java?rev=1234971&r1=1234970&r2=1234971&view=diff
==============================================================================
--- 
cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/event/DispatchQueue.java
 (original)
+++ 
cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/event/DispatchQueue.java
 Mon Jan 23 20:26:40 2012
@@ -89,24 +89,11 @@ class DispatchQueue {
             return removeInvocations(invocationsForSender(sender, false), 
listener);
         }
 
-        boolean didRemove = false;
-
         // remove listener from all collections
-        didRemove = removeInvocations(subjectInvocations, listener);
+        boolean didRemove = removeInvocations(subjectInvocations, listener);
 
         for (Collection<Invocation> senderInvocations : 
invocationsBySender.values()) {
-            if (senderInvocations == null) {
-                continue;
-            }
-
-            Iterator<Invocation> it = senderInvocations.iterator();
-            while (it.hasNext()) {
-                Invocation invocation = it.next();
-                if (invocation.getTarget() == listener) {
-                    it.remove();
-                    didRemove = true;
-                }
-            }
+            didRemove = removeInvocations(senderInvocations, listener) || 
didRemove;
         }
 
         return didRemove;


Reply via email to