Author: dkulp
Date: Tue Jan  4 19:33:59 2011
New Revision: 1055156

URL: http://svn.apache.org/viewvc?rev=1055156&view=rev
Log:
For a one-way, do a temporary yield after sticking it on the workqueue
to try and allow the messages to stay in order.

Modified:
    
cxf/trunk/rt/core/src/main/java/org/apache/cxf/interceptor/OneWayProcessorInterceptor.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=1055156&r1=1055155&r2=1055156&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
 Tue Jan  4 19:33:59 2011
@@ -99,15 +99,26 @@ public class OneWayProcessorInterceptor 
             if (Boolean.FALSE.equals(o)) {
                 chain.pause();
                 try {
-                    
message.getExchange().get(Bus.class).getExtension(WorkQueueManager.class)
-                    .getAutomaticWorkQueue().execute(new Runnable() {
-                        public void run() {
-                            chain.resume();
-                        }
-                    });
+                    synchronized (chain) {
+                        
message.getExchange().get(Bus.class).getExtension(WorkQueueManager.class)
+                            .getAutomaticWorkQueue().execute(new Runnable() {
+                                public void run() {
+                                    synchronized (chain) {
+                                        chain.notifyAll();
+                                    }
+                                    chain.resume();
+                                }
+                            });
+                        //wait a few milliseconds for the background thread to 
start processing
+                        //Mostly just to make an attempt at keeping the 
ordering of the 
+                        //messages coming in from a client.  Not guaranteed 
though.
+                        chain.wait(20);
+                    }
                 } catch (RejectedExecutionException e) {
                     //the executor queue is full, so run the task in the 
caller thread
                     chain.resume();
+                } catch (InterruptedException e) {
+                    //ignore - likely a busy work queue so we'll just let the 
one-way go
                 }
             }
         }


Reply via email to