[
https://issues.apache.org/jira/browse/HTTPASYNC-130?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16283802#comment-16283802
]
Oleg Kalnichevski commented on HTTPASYNC-130:
---------------------------------------------
There is absolutely no problem with using both classic and async HttpClient
implementations in the same application.
BTW, one can greatly reduce the chance of getting {{ConnectionClosedException}}
by limiting connection total time to live or keep-alive time
{code:java}
HttpAsyncClients.custom()
.setKeepAliveStrategy(new DefaultConnectionKeepAliveStrategy() {
@Override
public long getKeepAliveDuration(final HttpResponse response, final
HttpContext context) {
long keepAliveTime = super.getKeepAliveDuration(response,
context);
if (keepAliveTime < 0) {
keepAliveTime = TimeUnit.SECONDS.toMillis(30);
}
return keepAliveTime;
}
});
{code}
Oleg
> ConnectionClosed Exception
> --------------------------
>
> Key: HTTPASYNC-130
> URL: https://issues.apache.org/jira/browse/HTTPASYNC-130
> Project: HttpComponents HttpAsyncClient
> Issue Type: Bug
> Affects Versions: 4.1.3
> Reporter: Loganathan
>
> While invoking a server side API using http async library, the below
> exception is thrown:
> at
> org.apache.http.concurrent.BasicFuture.failed(BasicFuture.java:134)
> at
> org.apache.http.impl.nio.client.AbstractClientExchangeHandler.failed(AbstractClientExchangeHandler.java:414)
> at
> org.apache.http.nio.protocol.HttpAsyncRequestExecutor.endOfInput(HttpAsyncRequestExecutor.java:321)
> at
> org.apache.http.impl.nio.DefaultNHttpClientConnection.consumeInput(DefaultNHttpClientConnection.java:263)
> at
> org.apache.http.impl.nio.client.InternalIODispatch.onInputReady(InternalIODispatch.java:81)
> at
> org.apache.http.impl.nio.client.InternalIODispatch.onInputReady(InternalIODispatch.java:39)
> at
> org.apache.http.impl.nio.reactor.AbstractIODispatch.inputReady(AbstractIODispatch.java:123)
> at
> org.apache.http.impl.nio.reactor.BaseIOReactor.readable(BaseIOReactor.java:164)
> at
> org.apache.http.impl.nio.reactor.AbstractIOReactor.processEvent(AbstractIOReactor.java:339)
> at
> org.apache.http.impl.nio.reactor.AbstractIOReactor.processEvents(AbstractIOReactor.java:317)
> at
> org.apache.http.impl.nio.reactor.AbstractIOReactor.execute(AbstractIOReactor.java:278)
> at
> org.apache.http.impl.nio.reactor.BaseIOReactor.execute(BaseIOReactor.java:106)
> at
> org.apache.http.impl.nio.reactor.AbstractMultiworkerIOReactor$Worker.run(AbstractMultiworkerIOReactor.java:590)
> at java.lang.Thread.run(Thread.java:745)
> This exception is not consistent with the particular API. It is occurring
> randomly for different API's. At the same time, this exception didn't occur
> while invoking the same API(s) using normal http client.
--
This message was sent by Atlassian JIRA
(v6.4.14#64029)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]