List of usage examples for org.apache.http.impl.conn PoolingHttpClientConnectionManager closeExpiredConnections
public void closeExpiredConnections()
From source file:org.cleverbus.core.common.ws.transport.http.CloseableHttpComponentsMessageSender.java
/** * Create a new instance of the {@code HttpClientMessageSender} with a default {@link HttpClient} * that uses a default {@link org.apache.http.impl.conn.PoolingHttpClientConnectionManager}. *//* ww w .j ava 2s. c o m*/ public CloseableHttpComponentsMessageSender() { super(); PoolingHttpClientConnectionManager connPoolControl = new PoolingHttpClientConnectionManager(); connPoolControl.closeExpiredConnections(); this.connPoolControl = connPoolControl; // default values which can be overridden setConnectionTimeout(DEFAULT_CONNECTION_TIMEOUT_MILLISECONDS); setReadTimeout(DEFAULT_READ_TIMEOUT_MILLISECONDS); clientBuilder.addInterceptorFirst(new RemoveSoapHeadersInterceptor()).setUserAgent(MACHINE_NAME); authCache.set(new BasicAuthCache()); }
From source file:org.openscore.content.httpclient.ScoreHttpClient.java
private void checkKeepAlive(HttpRequestBase httpRequestBase, PoolingHttpClientConnectionManager connManager, String keepAliveInput, CloseableHttpResponse httpResponse) { boolean keepAlive = StringUtils.isBlank(keepAliveInput) || Boolean.parseBoolean(keepAliveInput); if (!keepAlive) { try {//from w w w . j av a 2 s . c om httpResponse.close(); } catch (IOException e) { throw new RuntimeException(e.getMessage(), e); } httpRequestBase.releaseConnection(); connManager.closeExpiredConnections(); } }
From source file:io.cloudslang.content.httpclient.CSHttpClient.java
private void checkKeepAlive(HttpRequestBase httpRequestBase, PoolingHttpClientConnectionManager connManager, String keepAliveInput, CloseableHttpResponse httpResponse) { boolean keepAlive = StringUtils.isBlank(keepAliveInput) || Boolean.parseBoolean(keepAliveInput); if (keepAlive) { httpRequestBase.releaseConnection(); } else {//from w w w . ja v a 2 s . c o m try { httpResponse.close(); } catch (IOException e) { throw new RuntimeException(e.getMessage(), e); } httpRequestBase.releaseConnection(); connManager.closeExpiredConnections(); } }