cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ningji...@apache.org
Subject svn commit: r1099336 - in /cxf/trunk/rt/transports/local/src/main/java/org/apache/cxf/transport/local: LocalConduit.java LocalDestination.java LocalTransportFactory.java
Date Wed, 04 May 2011 06:45:05 GMT
Author: ningjiang
Date: Wed May  4 06:45:05 2011
New Revision: 1099336

URL: http://svn.apache.org/viewvc?rev=1099336&view=rev
Log:
CXF-3473 enhance the LocalTransport to get the executor from different way

Modified:
    cxf/trunk/rt/transports/local/src/main/java/org/apache/cxf/transport/local/LocalConduit.java
    cxf/trunk/rt/transports/local/src/main/java/org/apache/cxf/transport/local/LocalDestination.java
    cxf/trunk/rt/transports/local/src/main/java/org/apache/cxf/transport/local/LocalTransportFactory.java

Modified: cxf/trunk/rt/transports/local/src/main/java/org/apache/cxf/transport/local/LocalConduit.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/transports/local/src/main/java/org/apache/cxf/transport/local/LocalConduit.java?rev=1099336&r1=1099335&r2=1099336&view=diff
==============================================================================
--- cxf/trunk/rt/transports/local/src/main/java/org/apache/cxf/transport/local/LocalConduit.java
(original)
+++ cxf/trunk/rt/transports/local/src/main/java/org/apache/cxf/transport/local/LocalConduit.java
Wed May  4 06:45:05 2011
@@ -24,6 +24,7 @@ import java.io.InputStream;
 import java.io.OutputStream;
 import java.io.PipedInputStream;
 import java.io.PipedOutputStream;
+import java.util.concurrent.Executor;
 import java.util.logging.Logger;
 
 import org.apache.cxf.common.logging.LogUtils;
@@ -34,6 +35,7 @@ import org.apache.cxf.message.ExchangeIm
 import org.apache.cxf.message.Message;
 import org.apache.cxf.message.MessageImpl;
 import org.apache.cxf.transport.AbstractConduit;
+import org.apache.cxf.workqueue.SynchronousExecutor;
 
 public class LocalConduit extends AbstractConduit {
 
@@ -137,10 +139,17 @@ public class LocalConduit extends Abstra
                             destination.getMessageObserver().onMessage(inMsg);
                         }
                     };
-                    if (transportFactory.getExecutor() != null) {
-                        transportFactory.getExecutor().execute(receiver);
+                    Executor ex = message.getExchange() != null
+                        ? message.getExchange().get(Executor.class) : null;
+                    if (ex == null || SynchronousExecutor.isA(ex)) {
+                        ex = transportFactory.getExecutor();
+                        if (ex != null) {
+                            ex.execute(receiver);
+                        } else {
+                            new Thread(receiver).start();
+                        }
                     } else {
-                        new Thread(receiver).start();
+                        ex.execute(receiver);
                     }
                 }
             };

Modified: cxf/trunk/rt/transports/local/src/main/java/org/apache/cxf/transport/local/LocalDestination.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/transports/local/src/main/java/org/apache/cxf/transport/local/LocalDestination.java?rev=1099336&r1=1099335&r2=1099336&view=diff
==============================================================================
--- cxf/trunk/rt/transports/local/src/main/java/org/apache/cxf/transport/local/LocalDestination.java
(original)
+++ cxf/trunk/rt/transports/local/src/main/java/org/apache/cxf/transport/local/LocalDestination.java
Wed May  4 06:45:05 2011
@@ -24,6 +24,7 @@ import java.io.InputStream;
 import java.io.OutputStream;
 import java.io.PipedInputStream;
 import java.io.PipedOutputStream;
+import java.util.concurrent.Executor;
 import java.util.logging.Logger;
 
 import org.apache.cxf.common.logging.LogUtils;
@@ -36,6 +37,7 @@ import org.apache.cxf.service.model.Endp
 import org.apache.cxf.transport.AbstractConduit;
 import org.apache.cxf.transport.AbstractDestination;
 import org.apache.cxf.transport.Conduit;
+import org.apache.cxf.workqueue.SynchronousExecutor;
 import org.apache.cxf.ws.addressing.EndpointReferenceType;
 
 public class LocalDestination extends AbstractDestination {
@@ -97,10 +99,18 @@ public class LocalDestination extends Ab
                                     conduit.getMessageObserver().onMessage(m);
                                 }
                             };
-                            if (localDestinationFactory.getExecutor() != null) {
-                                localDestinationFactory.getExecutor().execute(receiver);
+                            Executor ex = message.getExchange() != null
+                                ? message.getExchange().get(Executor.class) : null;
+                            // Need to avoid to get the SynchronousExecutor
+                            if (ex == null || SynchronousExecutor.isA(ex)) {
+                                ex = localDestinationFactory.getExecutor();
+                                if (ex != null) {
+                                    ex.execute(receiver);
+                                } else {
+                                    new Thread(receiver).start();
+                                }
                             } else {
-                                new Thread(receiver).start();
+                                ex.execute(receiver);
                             }
                         }
                     };

Modified: cxf/trunk/rt/transports/local/src/main/java/org/apache/cxf/transport/local/LocalTransportFactory.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/transports/local/src/main/java/org/apache/cxf/transport/local/LocalTransportFactory.java?rev=1099336&r1=1099335&r2=1099336&view=diff
==============================================================================
--- cxf/trunk/rt/transports/local/src/main/java/org/apache/cxf/transport/local/LocalTransportFactory.java
(original)
+++ cxf/trunk/rt/transports/local/src/main/java/org/apache/cxf/transport/local/LocalTransportFactory.java
Wed May  4 06:45:05 2011
@@ -126,7 +126,10 @@ public class LocalTransportFactory exten
                 if (executor == null) {
                     WorkQueueManager manager = bus.getExtension(WorkQueueManager.class);
                     if (manager != null) {
-                        executor =  manager.getAutomaticWorkQueue();
+                        executor =  manager.getNamedWorkQueue("local-transport");
+                        if (executor == null) {
+                            executor = manager.getAutomaticWorkQueue();
+                        }
                     }
                 }
             }



Mime
View raw message