hc-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ol...@apache.org
Subject svn commit: r358378 - /jakarta/httpcomponents/trunk/http-core/src/contrib/org/apache/http/contrib/benchmark/BenchmarkWorker.java
Date Wed, 21 Dec 2005 20:58:14 GMT
Author: olegk
Date: Wed Dec 21 12:58:08 2005
New Revision: 358378

URL: http://svn.apache.org/viewcvs?rev=358378&view=rev
Log:
Implemented the keep-alive connection check using the default connection keep-alive strategy

Modified:
    jakarta/httpcomponents/trunk/http-core/src/contrib/org/apache/http/contrib/benchmark/BenchmarkWorker.java

Modified: jakarta/httpcomponents/trunk/http-core/src/contrib/org/apache/http/contrib/benchmark/BenchmarkWorker.java
URL: http://svn.apache.org/viewcvs/jakarta/httpcomponents/trunk/http-core/src/contrib/org/apache/http/contrib/benchmark/BenchmarkWorker.java?rev=358378&r1=358377&r2=358378&view=diff
==============================================================================
--- jakarta/httpcomponents/trunk/http-core/src/contrib/org/apache/http/contrib/benchmark/BenchmarkWorker.java
(original)
+++ jakarta/httpcomponents/trunk/http-core/src/contrib/org/apache/http/contrib/benchmark/BenchmarkWorker.java
Wed Dec 21 12:58:08 2005
@@ -38,6 +38,8 @@
 import org.apache.http.HttpRequest;
 import org.apache.http.HttpResponse;
 import org.apache.http.executor.HttpRequestExecutor;
+import org.apache.http.impl.ConnectionReuseStrategy;
+import org.apache.http.impl.DefaultConnectionReuseStrategy;
 
 /**
  * <p>
@@ -53,10 +55,12 @@
     private byte[] buffer = new byte[4096];
     private final int verbosity;
     private final HttpRequestExecutor httpexecutor;
+    private final ConnectionReuseStrategy connstrategy;
     
     public BenchmarkWorker(final HttpRequestExecutor httpexecutor, int verbosity) {
         super();
         this.httpexecutor = httpexecutor;
+        this.connstrategy = new DefaultConnectionReuseStrategy();
         this.verbosity = verbosity;
     }
     
@@ -100,7 +104,7 @@
                         contentlen += l;
                     }
                 }
-                if (!keepalive) {
+                if (!keepalive || !this.connstrategy.keepAlive(response)) {
                     conn.close();
                 }
                 stats.setContentLength(contentlen);



Mime
View raw message