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);


-----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

Reply via email to