You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@hc.apache.org by "Carsten Reckord (JIRA)" <ji...@apache.org> on 2019/02/26 17:23:00 UTC

[jira] [Closed] (HTTPCLIENT-1971) Document alternatives to deprecated AbortableHttpRequest.abort()

     [ https://issues.apache.org/jira/browse/HTTPCLIENT-1971?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Carsten Reckord closed HTTPCLIENT-1971.
---------------------------------------
    Resolution: Invalid

Oh damn, I spent half the day trying to figure out a proper alternative, because the abort() call was flagged as deprecated in my code.

Fooled by my tooling I guess o.O

Copy-pasting the code from the "Abort method" example doesn't show any deprecation. And I just tried deleting and rewriting the couple of lines in my code around the abort() call and now the deprecation marker is gone there as well. I guess something got tripped up by the inheritance hierarchy with one abort() deprecated and the other not, or something...

Sorry for the noise.

> Document alternatives to deprecated AbortableHttpRequest.abort()
> ----------------------------------------------------------------
>
>                 Key: HTTPCLIENT-1971
>                 URL: https://issues.apache.org/jira/browse/HTTPCLIENT-1971
>             Project: HttpComponents HttpClient
>          Issue Type: Wish
>          Components: Documentation
>    Affects Versions: 4.5.7
>            Reporter: Carsten Reckord
>            Priority: Minor
>
> The {{AbortableHttpRequest}} interface was deprecated for HttpClient 4.3, but there is no good documentation on what the alternative is for callers who wish to cancel a request who would have previously called e.g. HttpGet.abort().
> The deprecation notice simply says _"use HttpExecutionAware"_. However, looking at {{HttpExecutionAware}} and its usages throughout HttpClient, this is apparenty intended for a different use-case. Or at least it is unclear how callers would achieve the desired cancellation.
> The [examples page|https://hc.apache.org/httpcomponents-client-ga/examples.html] still lists the [Abort method|https://hc.apache.org/httpcomponents-client-ga/httpclient/examples/org/apache/http/examples/client/ClientAbortMethod.java] example that uses the deprecated {{HttpGet.abort()}} method.
> [Another example|https://hc.apache.org/httpcomponents-client-ga/httpclient/examples/org/apache/http/examples/client/ClientWithRequestFuture.java] that isn't listed on the examples page and hence hard to find shows how to use {{FutureRequestExecutionService}}  to get a cancellable {{HttpRequestFutureTask}}. But looking at the code, that doesn't actually seem to cancel the actual request either - it just offloads it to a worker, and if it isn't already cancelled before the worker runs it, it goes through with the complete request.
>   
>  So far, my impression is that the only proper alternative is to go with the HttpAsyncClient API. But it would be nice if the HttpClient documentation and the deprecation notice on AbortableHttpRequest would either reflect that, or give other alternatives more explicitly.



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

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