use client in springboot with @Async
bigpws opened this issue · 3 comments
bigpws commented
When I use this in a springboot project with async, erros shows like:
java.lang.IllegalStateException: Connection pool shut down
at org.apache.http.util.Asserts.check(Asserts.java:34) ~[httpcore-4.4.8.jar:4.4.8]
at org.apache.http.pool.AbstractConnPool.lease(AbstractConnPool.java:191) ~[httpcore-4.4.8.jar:4.4.8]
at org.apache.http.impl.conn.PoolingHttpClientConnectionManager.requestConnection(PoolingHttpClientConnectionManager.java:257) ~[httpclient-4.5.3.jar:4.5.3]
at org.apache.http.impl.execchain.MainClientExec.execute(MainClientExec.java:176) ~[httpclient-4.5.3.jar:4.5.3]
at org.apache.http.impl.execchain.ProtocolExec.execute(ProtocolExec.java:185) ~[httpclient-4.5.3.jar:4.5.3]
at org.apache.http.impl.execchain.RetryExec.execute(RetryExec.java:89) ~[httpclient-4.5.3.jar:4.5.3]
at org.apache.http.impl.execchain.RedirectExec.execute(RedirectExec.java:111) ~[httpclient-4.5.3.jar:4.5.3]
at org.apache.http.impl.client.InternalHttpClient.doExecute(InternalHttpClient.java:185) ~[httpclient-4.5.3.jar:4.5.3]
at org.apache.http.impl.client.CloseableHttpClient.execute(CloseableHttpClient.java:83) ~[httpclient-4.5.3.jar:4.5.3]
at org.apache.http.impl.client.CloseableHttpClient.execute(CloseableHttpClient.java:108) ~[httpclient-4.5.3.jar:4.5.3]
at org.kairosdb.client.HttpClient.execute(HttpClient.java:107) ~[client-2.2.0.jar:na]
at org.kairosdb.client.HttpClient.postData(HttpClient.java:76) ~[client-2.2.0.jar:na]
at org.kairosdb.client.AbstractClient.pushMetrics(AbstractClient.java:87) ~[client-2.2.0.jar:na]
martin-g commented
Hi,
According to https://stackoverflow.com/a/34462361/497381 you can work it
around with:
HttpClients.custom().setConnectionManager(manager).
*setConnectionManagerShared(true)*.build();
And according to https://stackoverflow.com/a/25894224/497381 it is fixed in
Apache HttpClient 4.4 series.
…On Fri, Jun 1, 2018 at 8:38 AM, Sun Chen ***@***.***> wrote:
When I use this in a springboot project with async, erros shows like:
java.lang.IllegalStateException: Connection pool shut down
at org.apache.http.util.Asserts.check(Asserts.java:34) ~[httpcore-4.4.8.jar:4.4.8]
at org.apache.http.pool.AbstractConnPool.lease(AbstractConnPool.java:191) ~[httpcore-4.4.8.jar:4.4.8]
at org.apache.http.impl.conn.PoolingHttpClientConnectionManager.requestConnection(PoolingHttpClientConnectionManager.java:257) ~[httpclient-4.5.3.jar:4.5.3]
at org.apache.http.impl.execchain.MainClientExec.execute(MainClientExec.java:176) ~[httpclient-4.5.3.jar:4.5.3]
at org.apache.http.impl.execchain.ProtocolExec.execute(ProtocolExec.java:185) ~[httpclient-4.5.3.jar:4.5.3]
at org.apache.http.impl.execchain.RetryExec.execute(RetryExec.java:89) ~[httpclient-4.5.3.jar:4.5.3]
at org.apache.http.impl.execchain.RedirectExec.execute(RedirectExec.java:111) ~[httpclient-4.5.3.jar:4.5.3]
at org.apache.http.impl.client.InternalHttpClient.doExecute(InternalHttpClient.java:185) ~[httpclient-4.5.3.jar:4.5.3]
at org.apache.http.impl.client.CloseableHttpClient.execute(CloseableHttpClient.java:83) ~[httpclient-4.5.3.jar:4.5.3]
at org.apache.http.impl.client.CloseableHttpClient.execute(CloseableHttpClient.java:108) ~[httpclient-4.5.3.jar:4.5.3]
at org.kairosdb.client.HttpClient.execute(HttpClient.java:107) ~[client-2.2.0.jar:na]
at org.kairosdb.client.HttpClient.postData(HttpClient.java:76) ~[client-2.2.0.jar:na]
at org.kairosdb.client.AbstractClient.pushMetrics(AbstractClient.java:87) ~[client-2.2.0.jar:na]
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
<#72>, or mute the
thread
<https://github.com/notifications/unsubscribe-auth/AAOKQg5JRLGEXdFNQS5XD0015nf-SQoUks5t4NNVgaJpZM4UWIXs>
.