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] (HTTPCORE-253) getMetrics() does not work for HEAD or other early release methods
Date Tue, 12 Apr 2011 10:28:05 GMT

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

Sebb commented on HTTPCORE-253:
-------------------------------

In which case, maybe we should consider moving the metrics to the method, rather than the
connection? Or have metrics objects for both?

JMeter needs metrics for the individual method invocations, but there's probably a use case
for connection-based metrics too and/or httpclient metrics.

In the case of JMeter, httpclient metrics might be an alternative as one could just look at
the differences.
JMeter deliberately does not share connections between threads, so the re-lease problem does
not arise, but in general of course that needs to be fixed.

> getMetrics() does not work for HEAD or other early release methods
> ------------------------------------------------------------------
>
>                 Key: HTTPCORE-253
>                 URL: https://issues.apache.org/jira/browse/HTTPCORE-253
>             Project: HttpComponents HttpCore
>          Issue Type: Bug
>            Reporter: Sebb
>             Fix For: 4.2
>
>
> 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.
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