hc-httpclient-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Yoram Dayagi (Gmail)" <yor...@gmail.com>
Subject Re: How can I abort an aynsc request using HttpAsyncClient
Date Mon, 17 Feb 2014 09:23:04 GMT
I want to start an async GET request for a big file. Then, at some point, while the content
is still being received, I would like to cancel the request from another thread and close
all relevant resources.

I tried to achieve this behaviour by implementing AsyncByteConsumer and doing something like
the following, but I have the feeling that the connection from the connection pool was not
released:

…
        @Override
        protected void onByteReceived(ByteBuffer buf, IOControl ioctrl) throws IOException
{
		…
		ioctrl.shutdown();
		…
        }
…

Also, I read in documentation that using “shutdown” on a channel is bad for SSL connections,
where “close” should be called instead.

Thanks,
Yoram
On February 17, 2014 at 11:16:03 AM, Oleg Kalnichevski (olegk@apache.org) wrote:

On Sun, 2014-02-16 at 16:30 +0200, Yoram Dayagi (Gmail) wrote:  
> Hi  
> I would like to use HttpAsyncClient in order to execute async requests.  
> Is it possible to abort an executing request from another thread?  
>  

What exactly do you mean by aborting request execution? Unblocking a  
thread awaiting on the result future? Shutting down the underlying  
connection? What is it exactly you are trying to achieve?  

Oleg  



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


Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message