Author: gnodet
Date: Tue Jun 17 06:41:01 2008
New Revision: 668665
URL: http://svn.apache.org/viewvc?rev=668665&view=rev
Log:
SM-1407, SM-1408: add a per-endpoint timeout, fix a memory leak when a timeout
occurs
Modified:
servicemix/smx3/branches/servicemix-3.2/deployables/bindingcomponents/servicemix-http/src/main/java/org/apache/servicemix/http/HttpEndpoint.java
servicemix/smx3/branches/servicemix-3.2/deployables/bindingcomponents/servicemix-http/src/main/java/org/apache/servicemix/http/processors/ConsumerProcessor.java
servicemix/smx3/branches/servicemix-3.2/deployables/bindingcomponents/servicemix-http/src/main/java/org/apache/servicemix/http/processors/ProviderProcessor.java
Modified:
servicemix/smx3/branches/servicemix-3.2/deployables/bindingcomponents/servicemix-http/src/main/java/org/apache/servicemix/http/HttpEndpoint.java
URL:
http://svn.apache.org/viewvc/servicemix/smx3/branches/servicemix-3.2/deployables/bindingcomponents/servicemix-http/src/main/java/org/apache/servicemix/http/HttpEndpoint.java?rev=668665&r1=668664&r2=668665&view=diff
==============================================================================
---
servicemix/smx3/branches/servicemix-3.2/deployables/bindingcomponents/servicemix-http/src/main/java/org/apache/servicemix/http/HttpEndpoint.java
(original)
+++
servicemix/smx3/branches/servicemix-3.2/deployables/bindingcomponents/servicemix-http/src/main/java/org/apache/servicemix/http/HttpEndpoint.java
Tue Jun 17 06:41:01 2008
@@ -60,6 +60,7 @@
protected ProxyParameters proxy;
protected boolean synchronous;
protected boolean wantContentTypeHeaderFromExchangeIntoHttpRequest;
+ protected int timeout;
public boolean isWantContentTypeHeaderFromExchangeIntoHttpRequest() {
return wantContentTypeHeaderFromExchangeIntoHttpRequest;
@@ -154,8 +155,8 @@
}
/**
- * @param basicAuthentication
- * The basicAuthentication to set.
+ * @param basicAuthCredentials
+ * The basicAuthCredentials to set.
*/
public void setBasicAuthentication(BasicAuthCredentials
basicAuthCredentials) {
this.basicAuthentication = basicAuthCredentials;
@@ -184,6 +185,14 @@
super.setRoleAsString(role);
}
+ public int getTimeout() {
+ return timeout;
+ }
+
+ public void setTimeout(int timeout) {
+ this.timeout = timeout;
+ }
+
public void reloadWsdl() {
description = null;
definition = null;
Modified:
servicemix/smx3/branches/servicemix-3.2/deployables/bindingcomponents/servicemix-http/src/main/java/org/apache/servicemix/http/processors/ConsumerProcessor.java
URL:
http://svn.apache.org/viewvc/servicemix/smx3/branches/servicemix-3.2/deployables/bindingcomponents/servicemix-http/src/main/java/org/apache/servicemix/http/processors/ConsumerProcessor.java?rev=668665&r1=668664&r2=668665&view=diff
==============================================================================
---
servicemix/smx3/branches/servicemix-3.2/deployables/bindingcomponents/servicemix-http/src/main/java/org/apache/servicemix/http/processors/ConsumerProcessor.java
(original)
+++
servicemix/smx3/branches/servicemix-3.2/deployables/bindingcomponents/servicemix-http/src/main/java/org/apache/servicemix/http/processors/ConsumerProcessor.java
Tue Jun 17 06:41:01 2008
@@ -79,7 +79,10 @@
this.soapHelper = new SoapHelper(endpoint);
this.locks = new ConcurrentHashMap<String, Continuation>();
this.exchanges = new ConcurrentHashMap<String, MessageExchange>();
- this.suspentionTime =
getConfiguration().getConsumerProcessorSuspendTime();
+ this.suspentionTime = endpoint.getTimeout();
+ if (suspentionTime <= 0) {
+ this.suspentionTime =
getConfiguration().getConsumerProcessorSuspendTime();
+ }
}
public SslParameters getSsl() {
@@ -162,6 +165,7 @@
boolean result = cont.suspend(suspentionTime);
exchange = exchanges.remove(exchange.getExchangeId());
if (!result) {
+ locks.remove(exchange.getExchangeId());
throw new Exception("Error sending exchange: aborted");
}
request.removeAttribute(MessageExchange.class.getName());
@@ -172,7 +176,7 @@
sendFault(fault, request, response);
return;
} catch (Exception e) {
- SoapFault fault = new SoapFault(e);
+ SoapFault fault = new SoapFault(e);
sendFault(fault, request, response);
return;
}
Modified:
servicemix/smx3/branches/servicemix-3.2/deployables/bindingcomponents/servicemix-http/src/main/java/org/apache/servicemix/http/processors/ProviderProcessor.java
URL:
http://svn.apache.org/viewvc/servicemix/smx3/branches/servicemix-3.2/deployables/bindingcomponents/servicemix-http/src/main/java/org/apache/servicemix/http/processors/ProviderProcessor.java?rev=668665&r1=668664&r2=668665&view=diff
==============================================================================
---
servicemix/smx3/branches/servicemix-3.2/deployables/bindingcomponents/servicemix-http/src/main/java/org/apache/servicemix/http/processors/ProviderProcessor.java
(original)
+++
servicemix/smx3/branches/servicemix-3.2/deployables/bindingcomponents/servicemix-http/src/main/java/org/apache/servicemix/http/processors/ProviderProcessor.java
Tue Jun 17 06:41:01 2008
@@ -330,7 +330,9 @@
protected HttpClient getClient() {
HttpComponent comp = (HttpComponent)
endpoint.getServiceUnit().getComponent();
- return comp.getClient();
+ HttpClient client = comp.getClient();
+ client.getParams().setSoTimeout(endpoint.getTimeout());
+ return client;
}
public static class StreamingRequestEntity implements RequestEntity {