You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@hc.apache.org by "Oleg Kalnichevski (JIRA)" <ji...@apache.org> on 2017/03/20 10:45:41 UTC
[jira] [Comment Edited] (HTTPCLIENT-1583) Add option to create a
connection eviction thread for a non-shared connection manager
[ https://issues.apache.org/jira/browse/HTTPCLIENT-1583?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15932478#comment-15932478 ]
Oleg Kalnichevski edited comment on HTTPCLIENT-1583 at 3/20/17 10:45 AM:
-------------------------------------------------------------------------
Ah, yes, you are right. I made a mistake. The IdleConnectionEvictor constructor call should have been something like that
{code:java}
final IdleConnectionEvictor connectionEvictor = new IdleConnectionEvictor((ConnPoolControl<?>) connManagerCopy,
maxIdleTime > 0 ? maxIdleTime : 10, maxIdleTimeUnit != null ? maxIdleTimeUnit : TimeUnit.SECONDS,
maxIdleTime, maxIdleTimeUnit);
{code}
Feel free to raise a JIRA or / and a PR at Github for this defect.
Oleg
was (Author: olegk):
Ah, yes, you are right. I did a mistake. The IdleConnectionEvictor constructor call should have been something like that
{code:java}
final IdleConnectionEvictor connectionEvictor = new IdleConnectionEvictor((ConnPoolControl<?>) connManagerCopy,
maxIdleTime > 0 ? maxIdleTime : 10, maxIdleTimeUnit != null ? maxIdleTimeUnit : TimeUnit.SECONDS,
maxIdleTime, maxIdleTimeUnit);
{code}
Feel free to raise a JIRA or / and a PR at Github for this defect.
Oleg
> Add option to create a connection eviction thread for a non-shared connection manager
> -------------------------------------------------------------------------------------
>
> Key: HTTPCLIENT-1583
> URL: https://issues.apache.org/jira/browse/HTTPCLIENT-1583
> Project: HttpComponents HttpClient
> Issue Type: Improvement
> Affects Versions: 4.3.5
> Reporter: yair ogen
> Priority: Minor
> Fix For: 4.4 Final
>
>
> In the tutorial:
> http://hc.apache.org/httpcomponents-client-ga/tutorial/html/connmgmt.html, section 2.5 Connection eviction policy - you explain how to clean-up connections. Although I can argue against the design as without this if server closes connections, my client gets many sockets stuck on CLOSE_WAIT - adding this thread solves the CLOSE_WAIT issue.
> However, I don't understand why you don't do this yourself if keep-alive is set. I would expect the library to support such a thread. In the meanwhile, it seems that if I use the default connection manager, I can't use non-deprecated code to call :
> connMgr.closeExpiredConnections();
> and
> connMgr.closeIdleConnections(30, TimeUnit.SECONDS);
> This is because the only exposed API to get the default pooling connection manager is by calling:
> httpClient.getConnectionManager(), which is deprecated. Javadoc suggests to go to the builder (which I do use but not for creating connection pool as the default is good enough for me) which is useless.
> So - how should one acquire a reference to the connection manager?
--
This message was sent by Atlassian JIRA
(v6.3.15#6346)
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@hc.apache.org
For additional commands, e-mail: dev-help@hc.apache.org