cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dk...@apache.org
Subject svn commit: r1360189 - in /cxf/trunk/rt/transports/http/src/main: java/org/apache/cxf/transport/http/HTTPConduit.java resources/schemas/wsdl/http-conf.xsd
Date Wed, 11 Jul 2012 14:25:41 GMT
Author: dkulp
Date: Wed Jul 11 14:25:40 2012
New Revision: 1360189

URL: http://svn.apache.org/viewvc?rev=1360189&view=rev
Log:
[CXF-4417] Add settings to control the async behavior of the conduit

Modified:
    cxf/trunk/rt/transports/http/src/main/java/org/apache/cxf/transport/http/HTTPConduit.java
    cxf/trunk/rt/transports/http/src/main/resources/schemas/wsdl/http-conf.xsd

Modified: cxf/trunk/rt/transports/http/src/main/java/org/apache/cxf/transport/http/HTTPConduit.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/transports/http/src/main/java/org/apache/cxf/transport/http/HTTPConduit.java?rev=1360189&r1=1360188&r2=1360189&view=diff
==============================================================================
--- cxf/trunk/rt/transports/http/src/main/java/org/apache/cxf/transport/http/HTTPConduit.java
(original)
+++ cxf/trunk/rt/transports/http/src/main/java/org/apache/cxf/transport/http/HTTPConduit.java
Wed Jul 11 14:25:40 2012
@@ -1538,6 +1538,7 @@ public class HTTPConduit 
                         }
                     }
                 };
+                HTTPClientPolicy policy = getClient(outMessage);
                 try {
                     Executor ex = outMessage.getExchange().get(Executor.class);
                     if (ex == null) {
@@ -1547,13 +1548,25 @@ public class HTTPConduit 
                         if (qu == null) {
                             qu = mgr.getAutomaticWorkQueue();
                         }
-                        qu.execute(runnable, 5000);
+                        long timeout = 5000;
+                        if (policy != null && policy.isSetAsyncExecuteTimeout())
{
+                            timeout = policy.getAsyncExecuteTimeout();
+                        }
+                        if (timeout > 0) {
+                            qu.execute(runnable, timeout);
+                        } else {
+                            qu.execute(runnable);
+                        }
                     } else {
                         outMessage.getExchange().put(Executor.class.getName() 
                                                  + ".USING_SPECIFIED", Boolean.TRUE);
                         ex.execute(runnable);
                     }
                 } catch (RejectedExecutionException rex) {
+                    if (policy != null && policy.isSetAsyncExecuteTimeoutRejection()
+                        && policy.isAsyncExecuteTimeoutRejection()) {
+                        throw rex;
+                    }
                     LOG.warning("EXECUTOR_FULL");
                     handleResponseInternal();
                 }

Modified: cxf/trunk/rt/transports/http/src/main/resources/schemas/wsdl/http-conf.xsd
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/transports/http/src/main/resources/schemas/wsdl/http-conf.xsd?rev=1360189&r1=1360188&r2=1360189&view=diff
==============================================================================
--- cxf/trunk/rt/transports/http/src/main/resources/schemas/wsdl/http-conf.xsd (original)
+++ cxf/trunk/rt/transports/http/src/main/resources/schemas/wsdl/http-conf.xsd Wed Jul 11
14:25:40 2012
@@ -183,6 +183,22 @@
                     </xs:annotation>      
                 </xs:attribute>
 
+                <xs:attribute name="AsyncExecuteTimeout" type="ptp:ParameterizedUInt"
use="optional" default="5000">
+                    <xs:annotation>
+                        <xs:documentation>
+                        Specifies the amount of time, in milliseconds, that a conduit will
try and enqueue the response on the workqueue.
+                        </xs:documentation>
+                    </xs:annotation>      
+                </xs:attribute>
+                <xs:attribute name="AsyncExecuteTimeoutRejection" type="ptp:ParameterizedBoolean"
use="optional" default="false">
+                    <xs:annotation>
+                        <xs:documentation>
+                        Specifies whether the conduit should throw and exception if it fails
to enqueue the async response handling onto the workqueue. 
+                        By default, if the conduit fails to enqueue the response handling
on the workqueue, it will process the response on the current thread.  Set this to true to
raise and exception instead.  
+                        </xs:documentation>
+                    </xs:annotation>      
+                </xs:attribute>
+                
                 <xs:attribute name="AutoRedirect" type="ptp:ParameterizedBoolean" use="optional"
default="false">
                     <xs:annotation>
                         <xs:documentation>



Mime
View raw message