Author: sergeyb
Date: Fri Feb 14 16:33:13 2014
New Revision: 1568344
URL: http://svn.apache.org/r1568344
Log:
Merged revisions 1568343 via svnmerge from
https://svn.apache.org/repos/asf/cxf/trunk
........
r1568343 | sergeyb | 2014-02-14 16:28:49 +0000 (Fri, 14 Feb 2014) | 1 line
[CXF-5559] Preventing the infinite loop in case of connection exceptions
during the async calls, patch applied on behalf of Anthony Communier
........
Modified:
cxf/branches/2.7.x-fixes/ (props changed)
cxf/branches/2.7.x-fixes/rt/transports/http/src/main/java/org/apache/cxf/transport/http/HTTPConduit.java
Propchange: cxf/branches/2.7.x-fixes/
------------------------------------------------------------------------------
Merged /cxf/trunk:r1568343
Propchange: cxf/branches/2.7.x-fixes/
------------------------------------------------------------------------------
Binary property 'svnmerge-integrated' - no diff available.
Modified:
cxf/branches/2.7.x-fixes/rt/transports/http/src/main/java/org/apache/cxf/transport/http/HTTPConduit.java
URL:
http://svn.apache.org/viewvc/cxf/branches/2.7.x-fixes/rt/transports/http/src/main/java/org/apache/cxf/transport/http/HTTPConduit.java?rev=1568344&r1=1568343&r2=1568344&view=diff
==============================================================================
---
cxf/branches/2.7.x-fixes/rt/transports/http/src/main/java/org/apache/cxf/transport/http/HTTPConduit.java
(original)
+++
cxf/branches/2.7.x-fixes/rt/transports/http/src/main/java/org/apache/cxf/transport/http/HTTPConduit.java
Fri Feb 14 16:33:13 2014
@@ -1140,54 +1140,57 @@ public abstract class HTTPConduit
}
};
HTTPClientPolicy policy = getClient(outMessage);
- try {
- Executor ex = outMessage.getExchange().get(Executor.class);
- if (forceWQ && ex != null) {
- final Executor ex2 = ex;
- final Runnable origRunnable = runnable;
- runnable = new Runnable() {
- public void run() {
-
outMessage.getExchange().put(Executor.class.getName()
- + ".USING_SPECIFIED",
Boolean.TRUE);
- ex2.execute(origRunnable);
+ boolean exceptionSet = outMessage.getContent(Exception.class) !=
null;
+ if (!exceptionSet) {
+ try {
+ Executor ex = outMessage.getExchange().get(Executor.class);
+ if (forceWQ && ex != null) {
+ final Executor ex2 = ex;
+ final Runnable origRunnable = runnable;
+ runnable = new Runnable() {
+ public void run() {
+
outMessage.getExchange().put(Executor.class.getName()
+ +
".USING_SPECIFIED", Boolean.TRUE);
+ ex2.execute(origRunnable);
+ }
+ };
+ }
+ if (ex == null || forceWQ) {
+ WorkQueueManager mgr =
outMessage.getExchange().get(Bus.class)
+ .getExtension(WorkQueueManager.class);
+ AutomaticWorkQueue qu =
mgr.getNamedWorkQueue("http-conduit");
+ if (qu == null) {
+ qu = mgr.getAutomaticWorkQueue();
+ }
+ long timeout = 1000;
+ if (policy != null &&
policy.isSetAsyncExecuteTimeout()) {
+ timeout = policy.getAsyncExecuteTimeout();
+ }
+ if (timeout > 0) {
+ qu.execute(runnable, timeout);
+ } else {
+ qu.execute(runnable);
}
- };
- }
- if (ex == null || forceWQ) {
- WorkQueueManager mgr =
outMessage.getExchange().get(Bus.class)
- .getExtension(WorkQueueManager.class);
- AutomaticWorkQueue qu =
mgr.getNamedWorkQueue("http-conduit");
- if (qu == null) {
- qu = mgr.getAutomaticWorkQueue();
- }
- long timeout = 1000;
- if (policy != null && policy.isSetAsyncExecuteTimeout()) {
- timeout = policy.getAsyncExecuteTimeout();
- }
- if (timeout > 0) {
- qu.execute(runnable, timeout);
} else {
- qu.execute(runnable);
+ outMessage.getExchange().put(Executor.class.getName()
+ + ".USING_SPECIFIED",
Boolean.TRUE);
+ ex.execute(runnable);
+ }
+ } catch (RejectedExecutionException rex) {
+ if (allowCurrentThread
+ && policy != null
+ && policy.isSetAsyncExecuteTimeoutRejection()
+ && policy.isAsyncExecuteTimeoutRejection()) {
+ throw rex;
+ }
+ if (!hasLoggedAsyncWarning) {
+ LOG.warning("EXECUTOR_FULL_WARNING");
+ hasLoggedAsyncWarning = true;
}
- } else {
- outMessage.getExchange().put(Executor.class.getName()
- + ".USING_SPECIFIED",
Boolean.TRUE);
- ex.execute(runnable);
- }
- } catch (RejectedExecutionException rex) {
- if (allowCurrentThread
- && policy != null
- && policy.isSetAsyncExecuteTimeoutRejection()
- && policy.isAsyncExecuteTimeoutRejection()) {
- throw rex;
- }
- if (!hasLoggedAsyncWarning) {
- LOG.warning("EXECUTOR_FULL_WARNING");
- hasLoggedAsyncWarning = true;
+ LOG.fine("EXECUTOR_FULL");
+ handleResponseInternal();
}
- LOG.fine("EXECUTOR_FULL");
- handleResponseInternal();
- }
+ }
}