geronimo-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jlaskow...@apache.org
Subject svn commit: r606134 - in /geronimo/samples/trunk/samples/async-http/http-local-app/src/main/java/org/apache/geronimo: AsyncServlet.java BlockingServlet.java Utils.java
Date Fri, 21 Dec 2007 08:39:28 GMT
Author: jlaskowski
Date: Fri Dec 21 00:39:27 2007
New Revision: 606134

URL: http://svn.apache.org/viewvc?rev=606134&view=rev
Log:
GERONIMO-3716 sample app needs to be fixed according to recent changes to AsyncHttpClient
APIs

Contributed by: Sangjin Lee

Modified:
    geronimo/samples/trunk/samples/async-http/http-local-app/src/main/java/org/apache/geronimo/AsyncServlet.java
    geronimo/samples/trunk/samples/async-http/http-local-app/src/main/java/org/apache/geronimo/BlockingServlet.java
    geronimo/samples/trunk/samples/async-http/http-local-app/src/main/java/org/apache/geronimo/Utils.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=606134&r1=606133&r2=606134&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
Fri Dec 21 00:39:27 2007
@@ -42,7 +42,6 @@
 public class AsyncServlet extends HttpServlet implements CometProcessor {
 	@Override
 	public void destroy() {
-		// TODO Auto-generated method stub
 		super.destroy();
 		ahc.destroyAll();
 	}
@@ -56,7 +55,11 @@
 		remoteUrl = getServletConfig().getInitParameter("remoteUrl");
 
 		ExecutorService threadPool = Executors.newFixedThreadPool(8);
-    ahc = new AsyncHttpClient(threadPool);
+    	ahc = new AsyncHttpClient(threadPool, null);
+    	// enable connection reuse
+    	ahc.setReuseConnection(true);
+    	// disable TCP delay
+    	ahc.setTcpNoDelay(true);
 	}
 
 	/**
@@ -117,7 +120,6 @@
 				callback.setTime(new Date().getTime());
 				ahc.sendRequest(msgRequest);
 			} catch (Exception e) {
-				// TODO Auto-generated catch block
 				e.printStackTrace();
 			}
 		}

Modified: geronimo/samples/trunk/samples/async-http/http-local-app/src/main/java/org/apache/geronimo/BlockingServlet.java
URL: http://svn.apache.org/viewvc/geronimo/samples/trunk/samples/async-http/http-local-app/src/main/java/org/apache/geronimo/BlockingServlet.java?rev=606134&r1=606133&r2=606134&view=diff
==============================================================================
--- geronimo/samples/trunk/samples/async-http/http-local-app/src/main/java/org/apache/geronimo/BlockingServlet.java
(original)
+++ geronimo/samples/trunk/samples/async-http/http-local-app/src/main/java/org/apache/geronimo/BlockingServlet.java
Fri Dec 21 00:39:27 2007
@@ -28,11 +28,11 @@
 import javax.servlet.http.HttpServletResponse;
 
 /**
- * Servlet implementation class for Servlet: AsyncServlet
+ * Servlet implementation class for Servlet: BlockingServlet
  * 
- * @web.servlet name="AsyncServlet" display-name="AsyncServlet"
+ * @web.servlet name="BlockingServlet" display-name="BlockingServlet"
  * 
- * @web.servlet-mapping url-pattern="/async"
+ * @web.servlet-mapping url-pattern="/sync"
  * 
  */
 public class BlockingServlet extends HttpServlet {

Modified: geronimo/samples/trunk/samples/async-http/http-local-app/src/main/java/org/apache/geronimo/Utils.java
URL: http://svn.apache.org/viewvc/geronimo/samples/trunk/samples/async-http/http-local-app/src/main/java/org/apache/geronimo/Utils.java?rev=606134&r1=606133&r2=606134&view=diff
==============================================================================
--- geronimo/samples/trunk/samples/async-http/http-local-app/src/main/java/org/apache/geronimo/Utils.java
(original)
+++ geronimo/samples/trunk/samples/async-http/http-local-app/src/main/java/org/apache/geronimo/Utils.java
Fri Dec 21 00:39:27 2007
@@ -27,7 +27,7 @@
         Random generator = new Random();
 
         // generate a random delay between 10ms and 250 ms
-        int delay = generator.nextInt(2000) + 10;
+        int delay = generator.nextInt(240) + 10;
         params[0] = new Integer(delay);
 
         // generate randomly one of http status codes.



Mime
View raw message