org.apache.commons.httpclient.util
Class TimeoutController
java.lang.Object
org.apache.commons.httpclient.util.TimeoutController
public final class TimeoutController
extends java.lang.Object
Executes a task with a specified timeout.
static void | execute(Runnable task, long timeout) - Executes
task in a new deamon Thread and waits for the timeout.
|
static void | execute(Thread task, long timeout) - Executes
task .
|
execute
public static void execute(Runnable task,
long timeout)
throws TimeoutController.TimeoutException
Executes 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.
execute
public static void execute(Thread task,
long timeout)
throws TimeoutController.TimeoutException
Executes 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.
Copyright (c) 1999-2005 - Apache Software Foundation