Thanks a lot, that might do the job. I have the checks inside my code for timeouts (equivalent to a "stop flag"). I just needed a consistent way of "unblocking" the socket.
[]s Gustavo -----Original Message----- From: Roland Weber [mailto:[EMAIL PROTECTED] Sent: December 15, 2004 1:13 AM To: HttpClient User Discussion Subject: RE: How to set timeout parameters for a method? 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, Roland Gustavo Hexsel <[EMAIL PROTECTED]> 14.12.2004 17:53 Please respond to "HttpClient User Discussion" To "'HttpClient User Discussion'" <[email protected]> cc Subject RE: How to set timeout parameters for a method? How would I do that? I can't use Thread.stop() for a variety of reasons, and I don't know any other way of stopping in the middle of a blocking method. []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 kill the thread reuse mechanism -----Original Message----- From: Roland Weber [mailto:[EMAIL PROTECTED] 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. cheers, Roland --------------------------------------------------------------------- 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]
