On Fri, 2015-03-27 at 19:40 +0000, Huston, Jeff (Omaha) wrote:
> This seems to work, but is it unorthodox ?    My connection pool still seems 
> to be happy.
> 
> class HardTimeout {
>       Timer timer;
>                       
>       HardTimeout(int seconds) {
>               timer = new Timer();
>               timer.schedule(new TimeoutTask(), seconds * 1000);
>       }
>       class TimeoutTask extends TimerTask {
>               public void run() {
>                       httpGet.abort();
>                       timer.cancel();
>                       timer.purge();
>                       return;
>               }                               
>       }
> }
> new HardTimeout(60);

I think this is as good as it gets.

For details see:
https://issues.apache.org/jira/browse/HTTPCLIENT-1074

Oleg


> -----Original Message-----
> From: Huston, Jeff (Omaha) [mailto:[email protected]] 
> Sent: Friday, March 27, 2015 11:04 AM
> To: HttpClient User Discussion
> Subject: HttpClient timeouts
> 
> Hi, relatively new to HttpClient here.   So I can setup server connect, 
> socket, and connection pool time outs via the various RequestConfig methods 
> (setSocketTimeout, setConnectTimeout, setConnectionRequestTimeout, etc).
> 
> How would one ideally go about establishing a timeout or interrupting a 
> lengthy transfer which is in progress?   ie some kind of 'hard timeout' ?
> 
> Thanks in advance for anyone's insights.
> 
> Jeff
> 
> B�KKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKCB��[��X��ܚX�KK[XZ[
> ��Y[�
> ]\�\��][��X��ܚX�P˘\X�K�ܙ�B��܈Y][ۘ[��[X[��K[XZ[
> ��Y[�
> ]\�\��Z[˘\X�K�ܙ�B�B
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [email protected]
> For additional commands, e-mail: [email protected]
> 



---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to