cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dk...@apache.org
Subject svn commit: r781497 - in /cxf/trunk/rt: core/src/main/java/org/apache/cxf/interceptor/OneWayProcessorInterceptor.java transports/jms/src/main/java/org/apache/cxf/transport/jms/JMSDestination.java
Date Wed, 03 Jun 2009 18:00:44 GMT
Author: dkulp
Date: Wed Jun  3 18:00:44 2009
New Revision: 781497

URL: http://svn.apache.org/viewvc?rev=781497&view=rev
Log:
Allow the JMS transport to allow one-way operations to proceed on the
original thread so transactions will work.

Modified:
    cxf/trunk/rt/core/src/main/java/org/apache/cxf/interceptor/OneWayProcessorInterceptor.java
    cxf/trunk/rt/transports/jms/src/main/java/org/apache/cxf/transport/jms/JMSDestination.java

Modified: cxf/trunk/rt/core/src/main/java/org/apache/cxf/interceptor/OneWayProcessorInterceptor.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/core/src/main/java/org/apache/cxf/interceptor/OneWayProcessorInterceptor.java?rev=781497&r1=781496&r2=781497&view=diff
==============================================================================
--- cxf/trunk/rt/core/src/main/java/org/apache/cxf/interceptor/OneWayProcessorInterceptor.java
(original)
+++ cxf/trunk/rt/core/src/main/java/org/apache/cxf/interceptor/OneWayProcessorInterceptor.java
Wed Jun  3 18:00:44 2009
@@ -36,6 +36,9 @@
  * 
  */
 public class OneWayProcessorInterceptor extends AbstractPhaseInterceptor<Message> {
+    public static final String USE_ORIGINAL_THREAD 
+        = OneWayProcessorInterceptor.class.getName() + ".USE_ORIGINAL_THREAD"; 
+    
     public OneWayProcessorInterceptor() {
         super(Phase.PRE_LOGICAL);
     }
@@ -66,14 +69,21 @@
                 //IGNORE
             }
             
-            
-            chain.pause();
-            message.getExchange().get(Bus.class).getExtension(WorkQueueManager.class)
-                .getAutomaticWorkQueue().execute(new Runnable() {
-                    public void run() {
-                        chain.resume();
-                    }
-                });
+            Object o = message.getContextualProperty(USE_ORIGINAL_THREAD);
+            if (o == null) {
+                o = Boolean.FALSE;
+            } else if (o instanceof String) {
+                o = Boolean.valueOf((String)o);
+            }
+            if (Boolean.FALSE.equals(o)) {
+                chain.pause();
+                message.getExchange().get(Bus.class).getExtension(WorkQueueManager.class)
+                    .getAutomaticWorkQueue().execute(new Runnable() {
+                        public void run() {
+                            chain.resume();
+                        }
+                    });
+            }
         }
     }
     

Modified: cxf/trunk/rt/transports/jms/src/main/java/org/apache/cxf/transport/jms/JMSDestination.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/transports/jms/src/main/java/org/apache/cxf/transport/jms/JMSDestination.java?rev=781497&r1=781496&r2=781497&view=diff
==============================================================================
--- cxf/trunk/rt/transports/jms/src/main/java/org/apache/cxf/transport/jms/JMSDestination.java
(original)
+++ cxf/trunk/rt/transports/jms/src/main/java/org/apache/cxf/transport/jms/JMSDestination.java
Wed Jun  3 18:00:44 2009
@@ -48,6 +48,7 @@
 import org.apache.cxf.continuations.ContinuationProvider;
 import org.apache.cxf.continuations.SuspendedInvocationException;
 import org.apache.cxf.helpers.CastUtils;
+import org.apache.cxf.interceptor.OneWayProcessorInterceptor;
 import org.apache.cxf.message.Exchange;
 import org.apache.cxf.message.Message;
 import org.apache.cxf.message.MessageImpl;
@@ -82,6 +83,7 @@
         super(b, getTargetReference(info, b), info);
         this.bus = b;
         this.jmsConfig = jmsConfig;
+        info.setProperty(OneWayProcessorInterceptor.USE_ORIGINAL_THREAD, Boolean.TRUE);
     }
 
     /**



Mime
View raw message