Author: gnodet
Date: Tue Oct 17 02:55:56 2006
New Revision: 464883
URL: http://svn.apache.org/viewvc?view=rev&rev=464883
Log:
SM-713: Make time-out values configurable
Modified:
incubator/servicemix/trunk/servicemix-http/src/main/java/org/apache/servicemix/http/HttpConfiguration.java
incubator/servicemix/trunk/servicemix-http/src/main/java/org/apache/servicemix/http/HttpConfigurationMBean.java
incubator/servicemix/trunk/servicemix-http/src/main/java/org/apache/servicemix/http/jetty/JettyContextManager.java
incubator/servicemix/trunk/servicemix-http/src/main/java/org/apache/servicemix/http/processors/ConsumerProcessor.java
Modified:
incubator/servicemix/trunk/servicemix-http/src/main/java/org/apache/servicemix/http/HttpConfiguration.java
URL:
http://svn.apache.org/viewvc/incubator/servicemix/trunk/servicemix-http/src/main/java/org/apache/servicemix/http/HttpConfiguration.java?view=diff&rev=464883&r1=464882&r2=464883
==============================================================================
---
incubator/servicemix/trunk/servicemix-http/src/main/java/org/apache/servicemix/http/HttpConfiguration.java
(original)
+++
incubator/servicemix/trunk/servicemix-http/src/main/java/org/apache/servicemix/http/HttpConfiguration.java
Tue Oct 17 02:55:56 2006
@@ -88,6 +88,18 @@
private transient String mapping = MAPPING_DEFAULT;
/**
+ * Jetty connector max idle time
+ * (default value in jetty is 30000msec)
+ **/
+ private int connectorMaxIdleTime = 30000;
+
+ /**
+ * HttpConsumerProcessor continuation suspend time
+ * (default value in servicemix is 60000msec)
+ */
+ private int consumerProcessorSuspendTime = 60000;
+
+ /**
* @return Returns the rootDir.
*/
public String getRootDir() {
@@ -251,6 +263,25 @@
this.maxTotalConnections = maxTotalConnections;
save();
}
+
+ public int getConnectorMaxIdleTime() {
+ return connectorMaxIdleTime;
+ }
+
+ public void setConnectorMaxIdleTime(int connectorMaxIdleTime) {
+ this.connectorMaxIdleTime = connectorMaxIdleTime;
+ save();
+ }
+
+ public int getConsumerProcessorSuspendTime() {
+ return consumerProcessorSuspendTime;
+ }
+
+ public void setConsumerProcessorSuspendTime(int
consumerProcessorSuspendTime) {
+ this.consumerProcessorSuspendTime = consumerProcessorSuspendTime;
+ save();
+ }
+
public void save() {
properties.setProperty("jettyThreadPoolSize",
Integer.toString(jettyThreadPoolSize));
@@ -261,6 +292,8 @@
properties.setProperty("keystoreManagerName", keystoreManagerName);
properties.setProperty("authenticationServiceName",
authenticationServiceName);
properties.setProperty("jettyManagement",
Boolean.toString(jettyManagement));
+ properties.setProperty("connectorMaxIdleTime",
Integer.toString(connectorMaxIdleTime));
+ properties.setProperty("consumerProcessorSuspendTime",
Integer.toString(consumerProcessorSuspendTime));
if (rootDir != null) {
File f = new File(rootDir, CONFIG_FILE);
try {
@@ -307,6 +340,12 @@
}
if (properties.getProperty("jettyManagement") != null) {
jettyManagement =
Boolean.valueOf(properties.getProperty("jettyManagement")).booleanValue();
+ }
+ if (properties.getProperty("connectorMaxIdleTime") != null) {
+ connectorMaxIdleTime =
Integer.parseInt(properties.getProperty("connectorMaxIdleTime"));
+ }
+ if (properties.getProperty("consumerProcessorSuspendTime") != null) {
+ consumerProcessorSuspendTime =
Integer.parseInt(properties.getProperty("consumerProcessorSuspendTime"));
}
return true;
}
Modified:
incubator/servicemix/trunk/servicemix-http/src/main/java/org/apache/servicemix/http/HttpConfigurationMBean.java
URL:
http://svn.apache.org/viewvc/incubator/servicemix/trunk/servicemix-http/src/main/java/org/apache/servicemix/http/HttpConfigurationMBean.java?view=diff&rev=464883&r1=464882&r2=464883
==============================================================================
---
incubator/servicemix/trunk/servicemix-http/src/main/java/org/apache/servicemix/http/HttpConfigurationMBean.java
(original)
+++
incubator/servicemix/trunk/servicemix-http/src/main/java/org/apache/servicemix/http/HttpConfigurationMBean.java
Tue Oct 17 02:55:56 2006
@@ -49,5 +49,13 @@
public boolean isJettyManagement();
public void setJettyManagement(boolean jettyManagement);
+
+ public int getConnectorMaxIdleTime();
+
+ public void setConnectorMaxIdleTime(int connectorMaxIdleTime);
+
+ public int getConsumerProcessorSuspendTime();
+
+ public void setConsumerProcessorSuspendTime(int
consumerProcessorSuspendTime);
}
Modified:
incubator/servicemix/trunk/servicemix-http/src/main/java/org/apache/servicemix/http/jetty/JettyContextManager.java
URL:
http://svn.apache.org/viewvc/incubator/servicemix/trunk/servicemix-http/src/main/java/org/apache/servicemix/http/jetty/JettyContextManager.java?view=diff&rev=464883&r1=464882&r2=464883
==============================================================================
---
incubator/servicemix/trunk/servicemix-http/src/main/java/org/apache/servicemix/http/jetty/JettyContextManager.java
(original)
+++
incubator/servicemix/trunk/servicemix-http/src/main/java/org/apache/servicemix/http/jetty/JettyContextManager.java
Tue Oct 17 02:55:56 2006
@@ -318,6 +318,7 @@
}
connector.setHost(url.getHost());
connector.setPort(url.getPort());
+ connector.setMaxIdleTime(this.configuration.getConnectorMaxIdleTime());
Server server = new Server();
server.setThreadPool(new ThreadPoolWrapper());
server.setConnectors(new Connector[] { connector });
Modified:
incubator/servicemix/trunk/servicemix-http/src/main/java/org/apache/servicemix/http/processors/ConsumerProcessor.java
URL:
http://svn.apache.org/viewvc/incubator/servicemix/trunk/servicemix-http/src/main/java/org/apache/servicemix/http/processors/ConsumerProcessor.java?view=diff&rev=464883&r1=464882&r2=464883
==============================================================================
---
incubator/servicemix/trunk/servicemix-http/src/main/java/org/apache/servicemix/http/processors/ConsumerProcessor.java
(original)
+++
incubator/servicemix/trunk/servicemix-http/src/main/java/org/apache/servicemix/http/processors/ConsumerProcessor.java
Tue Oct 17 02:55:56 2006
@@ -72,12 +72,14 @@
protected SoapHelper soapHelper;
protected Map locks;
protected Map exchanges;
+ protected int suspentionTime = 60000;
public ConsumerProcessor(HttpEndpoint endpoint) {
this.endpoint = endpoint;
this.soapHelper = new SoapHelper(endpoint);
this.locks = new ConcurrentHashMap();
this.exchanges = new ConcurrentHashMap();
+ this.suspentionTime = ((HttpComponent)
endpoint.getServiceUnit().getComponent()).getConfiguration().getConsumerProcessorSuspendTime();
}
public SslParameters getSsl() {
@@ -172,8 +174,7 @@
if (log.isDebugEnabled()) {
log.debug("Suspending continuation for exchange: "
+ exchange.getExchangeId());
}
- // TODO: make this timeout configurable
- boolean result = cont.suspend(1000 * 60); // 60 s
+ boolean result = cont.suspend(suspentionTime);
if (!result) {
throw new Exception("Error sending exchange:
aborted");
}