|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--org.apache.commons.httpclient.util.TimeoutController
Executes a task with a specified timeout.
Inner Class Summary | |
static interface |
TimeoutController.TimeoutException
Signals that the task timed out. |
Method Summary | |
static void |
execute(java.lang.Runnable task,
long timeout)
Executes task in a new deamon Thread and waits for the timeout. |
static void |
execute(java.lang.Thread task,
long timeout)
Executes task . |
Methods inherited from class java.lang.Object |
clone,
equals,
finalize,
getClass,
hashCode,
notify,
notifyAll,
toString,
wait,
wait,
wait |
Method Detail |
public static void execute(java.lang.Thread task, long timeout) throws TimeoutController.TimeoutException
task
. Waits for timeout
milliseconds for the task to end and returns. If the task does not return
in time, the thread is interrupted and an Exception is thrown.
The caller should override the Thread.interrupt() method to something that
quickly makes the thread die or use Thread.isInterrupted().task
- The thread to executetimeout
- The timeout in milliseconds. 0 means to wait forever.public static void execute(java.lang.Runnable task, long timeout) throws TimeoutController.TimeoutException
task
in a new deamon Thread and waits for the timeout.task
- The task to executetimeout
- The timeout in milliseconds. 0 means to wait forever.
|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |