hc-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Sebb (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (HTTPCLIENT-1081) getMetrics() does not work for HEAD or other early release methods
Date Wed, 21 Aug 2013 09:22:53 GMT

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

Sebb commented on HTTPCLIENT-1081:
----------------------------------

I think we wrote some method overloads that seem to work OK for our case.

However, it seems to me that metrics are still potentially useful.
Maybe there is some scope for adding a callback method or providing an optional metrics collector
that can be passed along with the request.

This would be an enhancement rather than a bug.

As far as this issue is then concerned, if getMetrics() cannot be fixed to work, the Javadoc
needs to be updated to make the purpose and limitations clear.
                
> getMetrics() does not work for HEAD or other early release methods
> ------------------------------------------------------------------
>
>                 Key: HTTPCLIENT-1081
>                 URL: https://issues.apache.org/jira/browse/HTTPCLIENT-1081
>             Project: HttpComponents HttpClient
>          Issue Type: Bug
>            Reporter: Sebb
>             Fix For: 4.3 Final
>
>
> The following code works fine for GET:
>            HttpResponse httpResponse =
> httpClient.execute(httpRequest, localContext);
>            HttpConnection conn = (HttpConnection)
> localContext.getAttribute(ExecutionContext.HTTP_CONNECTION);
>            HttpConnectionMetrics metrics = conn.getMetrics();
> but fails on the getMetrics() call when the request is HEAD:
>        org.apache.http.impl.conn.ConnectionShutdownException
>        at org.apache.http.impl.conn.AbstractClientConnAdapter.assertValid(AbstractClientConnAdapter.java:154)
>        at org.apache.http.impl.conn.AbstractClientConnAdapter.getMetrics(AbstractClientConnAdapter.java:190)
> This is because the getMetrics() method calls assertValid() which checks that the connection
has not been released, and the HEAD request is released as soon as it completes, before returning
to the caller.
> Possible solutions:
> - don't call assertValid() in getMetrics()
> - store a pointer to the metrics in the local context

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@hc.apache.org
For additional commands, e-mail: dev-help@hc.apache.org


Mime
View raw message