hc-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ol...@apache.org
Subject svn commit: r1603444 - in /httpcomponents/httpclient/trunk/fluent-hc/src: main/java/org/apache/http/client/fluent/Executor.java test/java/org/apache/http/client/fluent/TestFluent.java
Date Wed, 18 Jun 2014 13:07:11 GMT
Author: olegk
Date: Wed Jun 18 13:07:11 2014
New Revision: 1603444

URL: http://svn.apache.org/r1603444
Log:
Added static method to close idle connections used by the fluent executor

Modified:
    httpcomponents/httpclient/trunk/fluent-hc/src/main/java/org/apache/http/client/fluent/Executor.java
    httpcomponents/httpclient/trunk/fluent-hc/src/test/java/org/apache/http/client/fluent/TestFluent.java

Modified: httpcomponents/httpclient/trunk/fluent-hc/src/main/java/org/apache/http/client/fluent/Executor.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpclient/trunk/fluent-hc/src/main/java/org/apache/http/client/fluent/Executor.java?rev=1603444&r1=1603443&r2=1603444&view=diff
==============================================================================
--- httpcomponents/httpclient/trunk/fluent-hc/src/main/java/org/apache/http/client/fluent/Executor.java
(original)
+++ httpcomponents/httpclient/trunk/fluent-hc/src/main/java/org/apache/http/client/fluent/Executor.java
Wed Jun 18 13:07:11 2014
@@ -29,6 +29,7 @@ package org.apache.http.client.fluent;
 import java.io.IOException;
 import java.security.KeyManagementException;
 import java.security.NoSuchAlgorithmException;
+import java.util.concurrent.TimeUnit;
 
 import javax.net.ssl.SSLContext;
 
@@ -220,4 +221,12 @@ public class Executor {
     public static void unregisterScheme(final String name) {
     }
 
+    /**
+     * Closes all idle persistent connections used by the internal pool.
+     * @since 4.4
+     */
+    public static void closeIdleConnections() {
+        CONNMGR.closeIdleConnections(0, TimeUnit.MICROSECONDS);
+    }
+
 }

Modified: httpcomponents/httpclient/trunk/fluent-hc/src/test/java/org/apache/http/client/fluent/TestFluent.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpclient/trunk/fluent-hc/src/test/java/org/apache/http/client/fluent/TestFluent.java?rev=1603444&r1=1603443&r2=1603444&view=diff
==============================================================================
--- httpcomponents/httpclient/trunk/fluent-hc/src/test/java/org/apache/http/client/fluent/TestFluent.java
(original)
+++ httpcomponents/httpclient/trunk/fluent-hc/src/test/java/org/apache/http/client/fluent/TestFluent.java
Wed Jun 18 13:07:11 2014
@@ -29,7 +29,6 @@ package org.apache.http.client.fluent;
 import java.io.File;
 import java.io.IOException;
 import java.nio.charset.Charset;
-import java.util.concurrent.TimeUnit;
 
 import org.apache.http.HttpEntity;
 import org.apache.http.HttpEntityEnclosingRequest;
@@ -95,10 +94,8 @@ public class TestFluent extends LocalSer
 
     @After @Override
     public void shutDown() throws Exception {
-        if (this.server != null) {
-            this.server.shutdown(100, TimeUnit.MILLISECONDS);
-            this.server = null;
-        }
+        Executor.closeIdleConnections();
+        super.shutDown();
     }
 
     @Test



Mime
View raw message