[ 
https://issues.apache.org/jira/browse/HTTPCLIENT-2089?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

fanglikui updated HTTPCLIENT-2089:
----------------------------------
    Description: 
 

_public PoolingHttpClientManager(int maxTotal, int maxPerRoute, 
SSLConnectionSocketFactory sslConnFactory)_

_{ this.maxTotal = maxTotal; this.maxPerRoute = maxPerRoute; 
Registry<ConnectionSocketFactory> registry = null; registry = 
RegistryBuilder.<ConnectionSocketFactory>create().register(HTTP_PROTOCOL, 
PlainConnectionSocketFactory.getSocketFactory()).register(HTTPS_PROTOCOL, 
sslConnFactory).build(); this.gcm = new 
PoolingHttpClientConnectionManager(registry); 
this.gcm.setMaxTotal(this.maxTotal); 
this.gcm.setDefaultMaxPerRoute(this.maxPerRoute); 
this.gcm.setValidateAfterInactivity(TimeValue.ofMilliseconds(IDLE_CONNECTION_CHECK_SPAN));
 }_

*I used the upper configuration to get the connection pool, and got the 
httpclient builder as following:*

_HttpClients.custom()_
 _.setConnectionManager(this.gcm)_
 _.setConnectionManagerShared(true)_
 _.setKeepAliveStrategy(getKeepAliveStrategy())_
 _.setDefaultRequestConfig(requestConfig);_

Then I got the following error:

_java.lang.IllegalStateException: Connection pool shut down_
 _at org.apache.hc.core5.util.Asserts.check(Asserts.java:38) 
~[httpcore5-5.0.jar:5.0]_
 _at org.apache.hc.core5.pool.StrictConnPool.lease(StrictConnPool.java:173) 
~[httpcore5-5.0.jar:5.0]_
 _at 
org.apache.hc.client5.http.impl.io.PoolingHttpClientConnectionManager.lease(PoolingHttpClientConnectionManager.java:264)
 ~[httpclient5-5.0.jar:5.0]_
 _at 
org.apache.hc.client5.http.impl.classic.InternalExecRuntime.acquireEndpoint(InternalExecRuntime.java:103)
 ~[httpclient5-5.0.jar:5.0]_
 _at 
org.apache.hc.client5.http.impl.classic.ConnectExec.execute(ConnectExec.java:118)
 ~[httpclient5-5.0.jar:5.0]_
 _at 
org.apache.hc.client5.http.impl.classic.ExecChainElement.execute(ExecChainElement.java:51)
 ~[httpclient5-5.0.jar:5.0]_
 _at 
org.apache.hc.client5.http.impl.classic.ExecChainElement$1.proceed(ExecChainElement.java:57)
 ~[httpclient5-5.0.jar:5.0]_
 _at 
org.apache.hc.client5.http.impl.classic.ProtocolExec.execute(ProtocolExec.java:165)
 ~[httpclient5-5.0.jar:5.0]_
 _at 
org.apache.hc.client5.http.impl.classic.ExecChainElement.execute(ExecChainElement.java:51)
 ~[httpclient5-5.0.jar:5.0]_
 _at 
org.apache.hc.client5.http.impl.classic.ExecChainElement$1.proceed(ExecChainElement.java:57)
 ~[httpclient5-5.0.jar:5.0]_
 _at 
org.apache.hc.client5.http.impl.classic.HttpRequestRetryExec.execute(HttpRequestRetryExec.java:93)
 ~[httpclient5-5.0.jar:5.0]_
 _at 
org.apache.hc.client5.http.impl.classic.ExecChainElement.execute(ExecChainElement.java:51)
 ~[httpclient5-5.0.jar:5.0]_
 _at 
org.apache.hc.client5.http.impl.classic.ExecChainElement$1.proceed(ExecChainElement.java:57)
 ~[httpclient5-5.0.jar:5.0]_
 _at 
org.apache.hc.client5.http.impl.classic.RedirectExec.execute(RedirectExec.java:116)
 ~[httpclient5-5.0.jar:5.0]_
 _at 
org.apache.hc.client5.http.impl.classic.ExecChainElement.execute(ExecChainElement.java:51)
 ~[httpclient5-5.0.jar:5.0]_
 _at 
org.apache.hc.client5.http.impl.classic.ExecChainElement$1.proceed(ExecChainElement.java:57)
 ~[httpclient5-5.0.jar:5.0]_
 _at 
org.apache.hc.client5.http.impl.classic.ContentCompressionExec.execute(ContentCompressionExec.java:128)
 ~[httpclient5-5.0.jar:5.0]_
 _at 
org.apache.hc.client5.http.impl.classic.ExecChainElement.execute(ExecChainElement.java:51)
 ~[httpclient5-5.0.jar:5.0]_
 _at 
org.apache.hc.client5.http.impl.classic.InternalHttpClient.doExecute(InternalHttpClient.java:178)
 ~[httpclient5-5.0.jar:5.0]_
 _at 
org.apache.hc.client5.http.impl.classic.CloseableHttpClient.execute(CloseableHttpClient.java:96)
 ~[httpclient5-5.0.jar:5.0]_

 

Can anyone help me?

Thanks.

  was:
public PoolingHttpClientManager(int maxTotal, int maxPerRoute, 
SSLConnectionSocketFactory sslConnFactory) {
 this.maxTotal = maxTotal;
 this.maxPerRoute = maxPerRoute;

 Registry<ConnectionSocketFactory> registry = null;
 registry = 
RegistryBuilder.<ConnectionSocketFactory>create().register(HTTP_PROTOCOL,
 PlainConnectionSocketFactory.getSocketFactory()).register(HTTPS_PROTOCOL, 
sslConnFactory).build();

 this.gcm = new PoolingHttpClientConnectionManager(registry);
 this.gcm.setMaxTotal(this.maxTotal);
 this.gcm.setDefaultMaxPerRoute(this.maxPerRoute);
 
this.gcm.setValidateAfterInactivity(TimeValue.ofMilliseconds(IDLE_CONNECTION_CHECK_SPAN));
}

I used the upper configuration to get the connection pool, and get the 
httpclient builder as following:

HttpClients.custom()
 .setConnectionManager(this.gcm)
 .setConnectionManagerShared(true)
 .setKeepAliveStrategy(getKeepAliveStrategy())
 .setDefaultRequestConfig(requestConfig);

The I got the following error:

java.lang.IllegalStateException: Connection pool shut down
 at org.apache.hc.core5.util.Asserts.check(Asserts.java:38) 
~[httpcore5-5.0.jar:5.0]
 at org.apache.hc.core5.pool.StrictConnPool.lease(StrictConnPool.java:173) 
~[httpcore5-5.0.jar:5.0]
 at 
org.apache.hc.client5.http.impl.io.PoolingHttpClientConnectionManager.lease(PoolingHttpClientConnectionManager.java:264)
 ~[httpclient5-5.0.jar:5.0]
 at 
org.apache.hc.client5.http.impl.classic.InternalExecRuntime.acquireEndpoint(InternalExecRuntime.java:103)
 ~[httpclient5-5.0.jar:5.0]
 at 
org.apache.hc.client5.http.impl.classic.ConnectExec.execute(ConnectExec.java:118)
 ~[httpclient5-5.0.jar:5.0]
 at 
org.apache.hc.client5.http.impl.classic.ExecChainElement.execute(ExecChainElement.java:51)
 ~[httpclient5-5.0.jar:5.0]
 at 
org.apache.hc.client5.http.impl.classic.ExecChainElement$1.proceed(ExecChainElement.java:57)
 ~[httpclient5-5.0.jar:5.0]
 at 
org.apache.hc.client5.http.impl.classic.ProtocolExec.execute(ProtocolExec.java:165)
 ~[httpclient5-5.0.jar:5.0]
 at 
org.apache.hc.client5.http.impl.classic.ExecChainElement.execute(ExecChainElement.java:51)
 ~[httpclient5-5.0.jar:5.0]
 at 
org.apache.hc.client5.http.impl.classic.ExecChainElement$1.proceed(ExecChainElement.java:57)
 ~[httpclient5-5.0.jar:5.0]
 at 
org.apache.hc.client5.http.impl.classic.HttpRequestRetryExec.execute(HttpRequestRetryExec.java:93)
 ~[httpclient5-5.0.jar:5.0]
 at 
org.apache.hc.client5.http.impl.classic.ExecChainElement.execute(ExecChainElement.java:51)
 ~[httpclient5-5.0.jar:5.0]
 at 
org.apache.hc.client5.http.impl.classic.ExecChainElement$1.proceed(ExecChainElement.java:57)
 ~[httpclient5-5.0.jar:5.0]
 at 
org.apache.hc.client5.http.impl.classic.RedirectExec.execute(RedirectExec.java:116)
 ~[httpclient5-5.0.jar:5.0]
 at 
org.apache.hc.client5.http.impl.classic.ExecChainElement.execute(ExecChainElement.java:51)
 ~[httpclient5-5.0.jar:5.0]
 at 
org.apache.hc.client5.http.impl.classic.ExecChainElement$1.proceed(ExecChainElement.java:57)
 ~[httpclient5-5.0.jar:5.0]
 at 
org.apache.hc.client5.http.impl.classic.ContentCompressionExec.execute(ContentCompressionExec.java:128)
 ~[httpclient5-5.0.jar:5.0]
 at 
org.apache.hc.client5.http.impl.classic.ExecChainElement.execute(ExecChainElement.java:51)
 ~[httpclient5-5.0.jar:5.0]
 at 
org.apache.hc.client5.http.impl.classic.InternalHttpClient.doExecute(InternalHttpClient.java:178)
 ~[httpclient5-5.0.jar:5.0]
 at 
org.apache.hc.client5.http.impl.classic.CloseableHttpClient.execute(CloseableHttpClient.java:96)
 ~[httpclient5-5.0.jar:5.0]

 

Can anyone help me?

Thanks.

        Summary: "Connection pool shut down" error occurred When using 
HttpClient to send request. What is the reason?  (was: Connection pool shut 
down" error occurred When using HttpClient to send request. What is the reason?)

> "Connection pool shut down" error occurred When using HttpClient to send 
> request. What is the reason?
> -----------------------------------------------------------------------------------------------------
>
>                 Key: HTTPCLIENT-2089
>                 URL: https://issues.apache.org/jira/browse/HTTPCLIENT-2089
>             Project: HttpComponents HttpClient
>          Issue Type: Bug
>            Reporter: fanglikui
>            Priority: Major
>
>  
> _public PoolingHttpClientManager(int maxTotal, int maxPerRoute, 
> SSLConnectionSocketFactory sslConnFactory)_
> _{ this.maxTotal = maxTotal; this.maxPerRoute = maxPerRoute; 
> Registry<ConnectionSocketFactory> registry = null; registry = 
> RegistryBuilder.<ConnectionSocketFactory>create().register(HTTP_PROTOCOL, 
> PlainConnectionSocketFactory.getSocketFactory()).register(HTTPS_PROTOCOL, 
> sslConnFactory).build(); this.gcm = new 
> PoolingHttpClientConnectionManager(registry); 
> this.gcm.setMaxTotal(this.maxTotal); 
> this.gcm.setDefaultMaxPerRoute(this.maxPerRoute); 
> this.gcm.setValidateAfterInactivity(TimeValue.ofMilliseconds(IDLE_CONNECTION_CHECK_SPAN));
>  }_
> *I used the upper configuration to get the connection pool, and got the 
> httpclient builder as following:*
> _HttpClients.custom()_
>  _.setConnectionManager(this.gcm)_
>  _.setConnectionManagerShared(true)_
>  _.setKeepAliveStrategy(getKeepAliveStrategy())_
>  _.setDefaultRequestConfig(requestConfig);_
> Then I got the following error:
> _java.lang.IllegalStateException: Connection pool shut down_
>  _at org.apache.hc.core5.util.Asserts.check(Asserts.java:38) 
> ~[httpcore5-5.0.jar:5.0]_
>  _at org.apache.hc.core5.pool.StrictConnPool.lease(StrictConnPool.java:173) 
> ~[httpcore5-5.0.jar:5.0]_
>  _at 
> org.apache.hc.client5.http.impl.io.PoolingHttpClientConnectionManager.lease(PoolingHttpClientConnectionManager.java:264)
>  ~[httpclient5-5.0.jar:5.0]_
>  _at 
> org.apache.hc.client5.http.impl.classic.InternalExecRuntime.acquireEndpoint(InternalExecRuntime.java:103)
>  ~[httpclient5-5.0.jar:5.0]_
>  _at 
> org.apache.hc.client5.http.impl.classic.ConnectExec.execute(ConnectExec.java:118)
>  ~[httpclient5-5.0.jar:5.0]_
>  _at 
> org.apache.hc.client5.http.impl.classic.ExecChainElement.execute(ExecChainElement.java:51)
>  ~[httpclient5-5.0.jar:5.0]_
>  _at 
> org.apache.hc.client5.http.impl.classic.ExecChainElement$1.proceed(ExecChainElement.java:57)
>  ~[httpclient5-5.0.jar:5.0]_
>  _at 
> org.apache.hc.client5.http.impl.classic.ProtocolExec.execute(ProtocolExec.java:165)
>  ~[httpclient5-5.0.jar:5.0]_
>  _at 
> org.apache.hc.client5.http.impl.classic.ExecChainElement.execute(ExecChainElement.java:51)
>  ~[httpclient5-5.0.jar:5.0]_
>  _at 
> org.apache.hc.client5.http.impl.classic.ExecChainElement$1.proceed(ExecChainElement.java:57)
>  ~[httpclient5-5.0.jar:5.0]_
>  _at 
> org.apache.hc.client5.http.impl.classic.HttpRequestRetryExec.execute(HttpRequestRetryExec.java:93)
>  ~[httpclient5-5.0.jar:5.0]_
>  _at 
> org.apache.hc.client5.http.impl.classic.ExecChainElement.execute(ExecChainElement.java:51)
>  ~[httpclient5-5.0.jar:5.0]_
>  _at 
> org.apache.hc.client5.http.impl.classic.ExecChainElement$1.proceed(ExecChainElement.java:57)
>  ~[httpclient5-5.0.jar:5.0]_
>  _at 
> org.apache.hc.client5.http.impl.classic.RedirectExec.execute(RedirectExec.java:116)
>  ~[httpclient5-5.0.jar:5.0]_
>  _at 
> org.apache.hc.client5.http.impl.classic.ExecChainElement.execute(ExecChainElement.java:51)
>  ~[httpclient5-5.0.jar:5.0]_
>  _at 
> org.apache.hc.client5.http.impl.classic.ExecChainElement$1.proceed(ExecChainElement.java:57)
>  ~[httpclient5-5.0.jar:5.0]_
>  _at 
> org.apache.hc.client5.http.impl.classic.ContentCompressionExec.execute(ContentCompressionExec.java:128)
>  ~[httpclient5-5.0.jar:5.0]_
>  _at 
> org.apache.hc.client5.http.impl.classic.ExecChainElement.execute(ExecChainElement.java:51)
>  ~[httpclient5-5.0.jar:5.0]_
>  _at 
> org.apache.hc.client5.http.impl.classic.InternalHttpClient.doExecute(InternalHttpClient.java:178)
>  ~[httpclient5-5.0.jar:5.0]_
>  _at 
> org.apache.hc.client5.http.impl.classic.CloseableHttpClient.execute(CloseableHttpClient.java:96)
>  ~[httpclient5-5.0.jar:5.0]_
>  
> Can anyone help me?
> Thanks.



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to