Author: midon
Date: Mon Nov 2 23:00:25 2009
New Revision: 832176
URL: http://svn.apache.org/viewvc?rev=832176&view=rev
Log:
ODE-691: check periodically for idle http connections
Modified:
ode/branches/APACHE_ODE_1.X/axis2/src/main/java/org/apache/ode/axis2/ODEServer.java
Modified:
ode/branches/APACHE_ODE_1.X/axis2/src/main/java/org/apache/ode/axis2/ODEServer.java
URL:
http://svn.apache.org/viewvc/ode/branches/APACHE_ODE_1.X/axis2/src/main/java/org/apache/ode/axis2/ODEServer.java?rev=832176&r1=832175&r2=832176&view=diff
==============================================================================
---
ode/branches/APACHE_ODE_1.X/axis2/src/main/java/org/apache/ode/axis2/ODEServer.java
(original)
+++
ode/branches/APACHE_ODE_1.X/axis2/src/main/java/org/apache/ode/axis2/ODEServer.java
Mon Nov 2 23:00:25 2009
@@ -46,6 +46,7 @@
import org.apache.axis2.AxisFault;
import org.apache.axis2.engine.AxisConfiguration;
import org.apache.commons.httpclient.MultiThreadedHttpConnectionManager;
+import org.apache.commons.httpclient.util.IdleConnectionTimeoutThread;
import org.apache.commons.httpclient.params.HttpConnectionManagerParams;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
@@ -120,6 +121,7 @@
private ManagementService _mgtService;
protected MultiThreadedHttpConnectionManager httpConnectionManager;
+ protected IdleConnectionTimeoutThread idleConnectionTimeoutThread;
public void init(ServletConfig config, AxisConfiguration axisConf) throws
ServletException {
init(config.getServletContext().getRealPath("/WEB-INF"), axisConf);
@@ -361,6 +363,14 @@
__log.error("Unable to shut down HTTP connection
manager.", t);
}
}
+ if(idleConnectionTimeoutThread!=null){
+ __log.debug("shutting down Idle Connection Timeout Thread.");
+ try {
+ idleConnectionTimeoutThread.shutdown();
+ } catch(Throwable t) {
+ __log.error("Unable to shut down Idle Connection Timeout
Thread.", t);
+ }
+ }
try {
__log.debug("cleaning up temporary files.");
TempFileManager.cleanup();
@@ -516,6 +526,22 @@
}
httpConnectionManager.getParams().setDefaultMaxConnectionsPerHost(max_per_host);
httpConnectionManager.getParams().setMaxTotalConnections(max_total);
+
+ // Register the connection manager to a idle check thread
+ idleConnectionTimeoutThread = new IdleConnectionTimeoutThread();
+
idleConnectionTimeoutThread.setName("Http_Idle_Connection_Timeout_Thread");
+ long idleConnectionTimeout =
Long.parseLong(_odeConfig.getProperty("http.idle.connection.timeout", "30000"));
+ long idleConnectionCheckInterval =
Long.parseLong(_odeConfig.getProperty("http.idle.connection.check.interval",
"30000"));
+
+ if(__log.isDebugEnabled()){
+ __log.debug("http.idle.connection.timeout="+idleConnectionTimeout);
+
__log.debug("http.idle.connection.check.interval="+idleConnectionCheckInterval);
+ }
+
idleConnectionTimeoutThread.setConnectionTimeout(idleConnectionTimeout);
+
idleConnectionTimeoutThread.setTimeoutInterval(idleConnectionCheckInterval);
+
+
idleConnectionTimeoutThread.addConnectionManager(httpConnectionManager);
+ idleConnectionTimeoutThread.start();
}
public ProcessStoreImpl getProcessStore() {