cayenne-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From aadamc...@apache.org
Subject svn commit: r1382507 - /cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/util/EventUtil.java
Date Sun, 09 Sep 2012 14:33:08 GMT
Author: aadamchik
Date: Sun Sep  9 14:33:07 2012
New Revision: 1382507

URL: http://svn.apache.org/viewvc?rev=1382507&view=rev
Log:
CAY-1737 ObjectContexts listening to DataChannel events must be non-blocking

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

Modified: cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/util/EventUtil.java
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/util/EventUtil.java?rev=1382507&r1=1382506&r2=1382507&view=diff
==============================================================================
--- cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/util/EventUtil.java
(original)
+++ cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/util/EventUtil.java
Sun Sep  9 14:33:07 2012
@@ -87,7 +87,20 @@ public class EventUtil {
             String fqSubject = subject.getSubjectName();
             String method = fqSubject.substring(fqSubject.lastIndexOf('/') + 1);
 
-            manager.addListener(listener, method, GraphEvent.class, subject, sender);
+            // use non-blocking listeners for multi-threaded EM; blocking for single
+            // threaded...
+
+            if (manager.isSingleThreaded()) {
+                manager.addListener(listener, method, GraphEvent.class, subject, sender);
+            }
+            else {
+                manager.addNonBlockingListener(
+                        listener,
+                        method,
+                        GraphEvent.class,
+                        subject,
+                        sender);
+            }
         }
     }
 



Mime
View raw message