geronimo-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rickmcgu...@apache.org
Subject svn commit: r608106 - /geronimo/samples/trunk/samples/async-http/http-local-app/src/main/java/org/apache/geronimo/AsyncServlet.java
Date Wed, 02 Jan 2008 14:09:05 GMT
Author: rickmcguire
Date: Wed Jan  2 06:09:03 2008
New Revision: 608106

URL: http://svn.apache.org/viewvc?rev=608106&view=rev
Log:
GERONIMO-3720 the thread pool should be properly shut down in AHC sample app

Patch provided by Sangjin Lee


Modified:
    geronimo/samples/trunk/samples/async-http/http-local-app/src/main/java/org/apache/geronimo/AsyncServlet.java

Modified: geronimo/samples/trunk/samples/async-http/http-local-app/src/main/java/org/apache/geronimo/AsyncServlet.java
URL: http://svn.apache.org/viewvc/geronimo/samples/trunk/samples/async-http/http-local-app/src/main/java/org/apache/geronimo/AsyncServlet.java?rev=608106&r1=608105&r2=608106&view=diff
==============================================================================
--- geronimo/samples/trunk/samples/async-http/http-local-app/src/main/java/org/apache/geronimo/AsyncServlet.java
(original)
+++ geronimo/samples/trunk/samples/async-http/http-local-app/src/main/java/org/apache/geronimo/AsyncServlet.java
Wed Jan  2 06:09:03 2008
@@ -44,17 +44,19 @@
 	public void destroy() {
 		super.destroy();
 		ahc.destroyAll();
+		threadPool.shutdownNow();
 	}
 
 	static final long serialVersionUID = 1L;
 
 	private String remoteUrl;
 	private static AsyncHttpClient ahc;
+	private static ExecutorService threadPool;
 
 	public void init() throws ServletException {
 		remoteUrl = getServletConfig().getInitParameter("remoteUrl");
 
-		ExecutorService threadPool = Executors.newFixedThreadPool(8);
+		threadPool = Executors.newCachedThreadPool();
     	ahc = new AsyncHttpClient(threadPool, null);
     	// enable connection reuse
     	ahc.setReuseConnection(true);



Mime
View raw message