You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cxf.apache.org by ay...@apache.org on 2012/04/21 09:24:22 UTC

svn commit: r1328598 - in /cxf/trunk: api/src/main/java/org/apache/cxf/interceptor/OneWayProcessorInterceptor.java rt/ws/addr/src/main/java/org/apache/cxf/ws/addressing/impl/InternalContextUtils.java

Author: ay
Date: Sat Apr 21 07:24:21 2012
New Revision: 1328598

URL: http://svn.apache.org/viewvc?rev=1328598&view=rev
Log:
[CXF-4257] add an option for RejectedExecutionException handling for onway

Modified:
    cxf/trunk/api/src/main/java/org/apache/cxf/interceptor/OneWayProcessorInterceptor.java
    cxf/trunk/rt/ws/addr/src/main/java/org/apache/cxf/ws/addressing/impl/InternalContextUtils.java

Modified: cxf/trunk/api/src/main/java/org/apache/cxf/interceptor/OneWayProcessorInterceptor.java
URL: http://svn.apache.org/viewvc/cxf/trunk/api/src/main/java/org/apache/cxf/interceptor/OneWayProcessorInterceptor.java?rev=1328598&r1=1328597&r2=1328598&view=diff
==============================================================================
--- cxf/trunk/api/src/main/java/org/apache/cxf/interceptor/OneWayProcessorInterceptor.java (original)
+++ cxf/trunk/api/src/main/java/org/apache/cxf/interceptor/OneWayProcessorInterceptor.java Sat Apr 21 07:24:21 2012
@@ -150,11 +150,17 @@ public class OneWayProcessorInterceptor 
                         lock.wait(20);
                     }
                 } catch (RejectedExecutionException e) {
-                    //the executor queue is full, so run the task in the caller thread
                     LOG.warning(
                         "Executor queue is full, run the oneway invocation task in caller thread." 
                         + "  Users can specify a larger executor queue to avoid this.");
-                    chain.resume();
+                    // only block the thread if the prop is unset or set to false, otherwise let it go
+                    if (!MessageUtils.isTrue(
+                        message.getContextualProperty(
+                            "org.apache.cxf.oneway.rejected_execution_exception"))) {
+                        //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
                 }

Modified: cxf/trunk/rt/ws/addr/src/main/java/org/apache/cxf/ws/addressing/impl/InternalContextUtils.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/ws/addr/src/main/java/org/apache/cxf/ws/addressing/impl/InternalContextUtils.java?rev=1328598&r1=1328597&r2=1328598&view=diff
==============================================================================
--- cxf/trunk/rt/ws/addr/src/main/java/org/apache/cxf/ws/addressing/impl/InternalContextUtils.java (original)
+++ cxf/trunk/rt/ws/addr/src/main/java/org/apache/cxf/ws/addressing/impl/InternalContextUtils.java Sat Apr 21 07:24:21 2012
@@ -202,11 +202,16 @@ final class InternalContextUtils {
                                 }
                             });
                         } catch (RejectedExecutionException e) {
-                            //the executor queue is full, so run the task in the caller thread
                             LOG.warning(
                                         "Executor queue is full, use the caller thread." 
                                         + "  Users can specify a larger executor queue to avoid this.");
-                            inMessage.getInterceptorChain().resume();
+                            // only block the thread if the prop is unset or set to false, otherwise let it go
+                            if (!MessageUtils.isTrue(
+                                inMessage.getContextualProperty(
+                                    "org.apache.cxf.oneway.rejected_execution_exception"))) {
+                                //the executor queue is full, so run the task in the caller thread
+                                inMessage.getInterceptorChain().resume();
+                            }
                         }
                     }
                 }