Added static method to close idle connections used by the fluent executor
git-svn-id: https://svn.apache.org/repos/asf/httpcomponents/httpclient/trunk@1603444 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
2ebd820284
commit
48c22cc202
|
@ -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);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -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 LocalServerTestBase {
|
|||
|
||||
@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
|
||||
|
|
Loading…
Reference in New Issue