Return-Path: X-Original-To: apmail-hc-dev-archive@www.apache.org Delivered-To: apmail-hc-dev-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id CB97110585 for ; Wed, 4 Mar 2015 19:57:38 +0000 (UTC) Received: (qmail 57040 invoked by uid 500); 4 Mar 2015 19:57:38 -0000 Delivered-To: apmail-hc-dev-archive@hc.apache.org Received: (qmail 56997 invoked by uid 500); 4 Mar 2015 19:57:38 -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 56981 invoked by uid 99); 4 Mar 2015 19:57:38 -0000 Received: from arcas.apache.org (HELO arcas.apache.org) (140.211.11.28) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 04 Mar 2015 19:57:38 +0000 Date: Wed, 4 Mar 2015 19:57:38 +0000 (UTC) From: "Lucas Gut (JIRA)" To: dev@hc.apache.org Message-ID: In-Reply-To: References: Subject: [jira] [Commented] (HTTPCLIENT-1609) Implementation of validate() Required In CPool MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 [ https://issues.apache.org/jira/browse/HTTPCLIENT-1609?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14347463#comment-14347463 ] Lucas Gut commented on HTTPCLIENT-1609: --------------------------------------- Hi, thanks very much for fixing this issue. Do you know when 4.4.1 will be released? Thanks Lucas > Implementation of validate() Required In CPool > ---------------------------------------------- > > Key: HTTPCLIENT-1609 > URL: https://issues.apache.org/jira/browse/HTTPCLIENT-1609 > Project: HttpComponents HttpClient > Issue Type: Bug > Components: HttpClient > Affects Versions: 4.4 Final > Reporter: Charles Lip > Labels: patch > Fix For: 4.4.1 > > > In httpclient-4.4, org.apache.http.impl.conn.CPool directly inherits the dummy method validate() from abstract class org.apache.http.pool.AbstractConnPool:- > /** * @since 4.4 */ > protected boolean validate(final E entry) > { return true; } > Given that validate() always return TRUE, a critical portion of codes related to "closing stale connection" in method AbstractConnPool .getPoolEntryBlocking() is rendered unreachable. > Snippet of codes showing the unreachable part of method AbstractConnPool .getPoolEntryBlocking(): > .... > else if (this.validateAfterInactivity > 0) { > if (entry.getUpdated() + this.validateAfterInactivity <= System.currentTimeMillis()) { > if (!validate(entry)) { > entry.close(); //unreachable > } > } > } > ... .. > PoolingHttpClientConnectionManager, which is supported by CPool, is impaired by this defect for stale connection management logics involving validateAfterInactivity property. > CPool class needs a proper implementation of method validate(); a possible fix would be: > @Override > protected boolean validate(final CPoolEntry entry) { > return !entry.getConnection().isStale(); > } -- This message was sent by Atlassian JIRA (v6.3.4#6332) --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscribe@hc.apache.org For additional commands, e-mail: dev-help@hc.apache.org