Return-Path: X-Original-To: archive-asf-public-internal@cust-asf2.ponee.io Delivered-To: archive-asf-public-internal@cust-asf2.ponee.io Received: from cust-asf.ponee.io (cust-asf.ponee.io [163.172.22.183]) by cust-asf2.ponee.io (Postfix) with ESMTP id 8C39B200C61 for ; Mon, 20 Mar 2017 11:45:51 +0100 (CET) Received: by cust-asf.ponee.io (Postfix) id 89CBE160B81; Mon, 20 Mar 2017 10:45:51 +0000 (UTC) Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by cust-asf.ponee.io (Postfix) with SMTP id E503C160B92 for ; Mon, 20 Mar 2017 11:45:50 +0100 (CET) Received: (qmail 60131 invoked by uid 500); 20 Mar 2017 10:45:50 -0000 Mailing-List: contact dev-help@hc.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: "HttpComponents Project" Delivered-To: mailing list dev@hc.apache.org Received: (qmail 60115 invoked by uid 99); 20 Mar 2017 10:45:50 -0000 Received: from pnap-us-west-generic-nat.apache.org (HELO spamd2-us-west.apache.org) (209.188.14.142) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 20 Mar 2017 10:45:50 +0000 Received: from localhost (localhost [127.0.0.1]) by spamd2-us-west.apache.org (ASF Mail Server at spamd2-us-west.apache.org) with ESMTP id 7F5A61AFBB6 for ; Mon, 20 Mar 2017 10:45:49 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at spamd2-us-west.apache.org X-Spam-Flag: NO X-Spam-Score: 1.451 X-Spam-Level: * X-Spam-Status: No, score=1.451 tagged_above=-999 required=6.31 tests=[KAM_ASCII_DIVIDERS=0.8, RP_MATCHES_RCVD=-0.001, SPF_NEUTRAL=0.652] autolearn=disabled Received: from mx1-lw-eu.apache.org ([10.40.0.8]) by localhost (spamd2-us-west.apache.org [10.40.0.9]) (amavisd-new, port 10024) with ESMTP id jgps6TdlGnCS for ; Mon, 20 Mar 2017 10:45:48 +0000 (UTC) Received: from mailrelay1-us-west.apache.org (mailrelay1-us-west.apache.org [209.188.14.139]) by mx1-lw-eu.apache.org (ASF Mail Server at mx1-lw-eu.apache.org) with ESMTP id 131445FE47 for ; Mon, 20 Mar 2017 10:45:48 +0000 (UTC) Received: from jira-lw-us.apache.org (unknown [207.244.88.139]) by mailrelay1-us-west.apache.org (ASF Mail Server at mailrelay1-us-west.apache.org) with ESMTP id 04569E09F4 for ; Mon, 20 Mar 2017 10:45:43 +0000 (UTC) Received: from jira-lw-us.apache.org (localhost [127.0.0.1]) by jira-lw-us.apache.org (ASF Mail Server at jira-lw-us.apache.org) with ESMTP id D97E8254CF for ; Mon, 20 Mar 2017 10:45:41 +0000 (UTC) Date: Mon, 20 Mar 2017 10:45:41 +0000 (UTC) From: "Oleg Kalnichevski (JIRA)" To: dev@hc.apache.org Message-ID: In-Reply-To: References: Subject: [jira] [Commented] (HTTPCLIENT-1583) Add option to create a connection eviction thread for a non-shared connection manager MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 archived-at: Mon, 20 Mar 2017 10:45:51 -0000 [ https://issues.apache.org/jira/browse/HTTPCLIENT-1583?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15932478#comment-15932478 ] Oleg Kalnichevski commented on HTTPCLIENT-1583: ----------------------------------------------- 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