hc-httpclient-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Roland Weber <ROLWE...@de.ibm.com>
Subject RE: How to set timeout parameters for a method?
Date Wed, 15 Dec 2004 08:13:01 GMT
Hello Gustavo,

at least with HC3.0, HttpMethod.abort() should do the trick
while your thread is blocked in HC. It closes the socket and
thereby triggers an exception if the thread is blocked on
read, write, and I hope also if it is blocked on connect. If
the latter is not the case, you can file a bug report.

If your thread is not blocked but in some processing loop,
the JavaDocs for the deprecated Thread.stop() include a
link to a document that explains an alternative, which
basically relies on a flag variable that gets checked on a
regular basis and will be set by a different thread to
indicate a termination request.

hope that helps,

Gustavo Hexsel <ghexsel@sagebrushcorp.com> 
14.12.2004 17:53
Please respond to
"HttpClient User Discussion"

"'HttpClient User Discussion'" <httpclient-user@jakarta.apache.org>

RE: How to set timeout parameters for a method?

  How would I do that?  I can't use Thread.stop() for a variety of 
and I don't know any other way of stopping in the middle of a blocking

  []s Gustavo

PS.: reasons not to use thread.stop:
1 - might cause deadlocks or race conditions (multithreaded, locking to
prevent script modification while connectors are used)
2 - cleanup code might not get executed (finally blocks, returning
connections to the pool)
3 - I'm using Doug Lea's thread pooling library, not sure if that would 
the thread reuse mechanism

-----Original Message-----
From: Roland Weber [mailto:ROLWEBER@de.ibm.com]
Sent: December 14, 2004 12:45 AM
To: HttpClient User Discussion
Subject: RE: How to set timeout parameters for a method?

Hello Gustavo,

why don't you start a timout process at the beginning which
then aborts the method after the general timeout has expired?
No need to worry where the method execution is just then.


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

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