hc-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Oleg Kalnichevski (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (HTTPCLIENT-1609) Implementation of validate() Required In CPool
Date Fri, 12 Jun 2015 16:18:02 GMT

    [ https://issues.apache.org/jira/browse/HTTPCLIENT-1609?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14583631#comment-14583631
] 

Oleg Kalnichevski commented on HTTPCLIENT-1609:
-----------------------------------------------

Dmitry
It is a very valid point. Thinking of it now I should have probably placed the check outside
the locked section. It is not late to fix if there are any takers.

Oleg  

> 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


Mime
View raw message