You are viewing a plain text version of this content. The canonical link for it is here.
Posted to httpclient-users@hc.apache.org by Chris Lewis <ch...@bellsouth.net> on 2005/08/03 05:47:07 UTC

'cancelling' a request

Hello all,

I'm working an a project that uses HttpClient (3), and have a question
regarding threading (I know that I need to use a
MultiThreadedHttpConnectionManager). My question is this: how can I
safely terminate a pending request from a different thread? Assuming I
use a single (or pool of) IO thread, is it enough to just call
Thread.interrupt() to properly 'shut-down' and effectively cancel the
request?

regards,
Chris Lewis


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


Re: 'cancelling' a request

Posted by Chris Lewis <ch...@bellsouth.net>.
Hi Oleg,

Thank you for the confirmation. I'll have a look at the abort source for
clarity.

Chris


Oleg Kalnichevski wrote:

>Hi Chris,
>
>Call Thread#interrupt() first and wait for the thread to terminate
>cleanly for a grace period of your choice. If the thread fails to
>terminate, call HttpMethod#abort() on the respective HTTP method
>
>Hope this helps,
>
>Oleg
>
>
>On Tue, Aug 02, 2005 at 11:47:07PM -0400, Chris Lewis wrote:
>  
>
>>Hello all,
>>
>>I'm working an a project that uses HttpClient (3), and have a question
>>regarding threading (I know that I need to use a
>>MultiThreadedHttpConnectionManager). My question is this: how can I
>>safely terminate a pending request from a different thread? Assuming I
>>use a single (or pool of) IO thread, is it enough to just call
>>Thread.interrupt() to properly 'shut-down' and effectively cancel the
>>request?
>>
>>regards,
>>Chris Lewis
>>
>>
>>---------------------------------------------------------------------
>>To unsubscribe, e-mail: httpclient-user-unsubscribe@jakarta.apache.org
>>For additional commands, e-mail: httpclient-user-help@jakarta.apache.org
>>
>>
>>    
>>
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: httpclient-user-unsubscribe@jakarta.apache.org
>For additional commands, e-mail: httpclient-user-help@jakarta.apache.org
>
>
>  
>


Re: 'cancelling' a request

Posted by Oleg Kalnichevski <ol...@apache.org>.
Hi Chris,

Call Thread#interrupt() first and wait for the thread to terminate
cleanly for a grace period of your choice. If the thread fails to
terminate, call HttpMethod#abort() on the respective HTTP method

Hope this helps,

Oleg


On Tue, Aug 02, 2005 at 11:47:07PM -0400, Chris Lewis wrote:
> Hello all,
> 
> I'm working an a project that uses HttpClient (3), and have a question
> regarding threading (I know that I need to use a
> MultiThreadedHttpConnectionManager). My question is this: how can I
> safely terminate a pending request from a different thread? Assuming I
> use a single (or pool of) IO thread, is it enough to just call
> Thread.interrupt() to properly 'shut-down' and effectively cancel the
> request?
> 
> regards,
> Chris Lewis
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: httpclient-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: httpclient-user-help@jakarta.apache.org
> 
> 

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