TimeoutController (HttpClient 3.1 API)
Keywords: org.apache.commons.httpclient.util.TimeoutController class

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.apache.commons.httpclient.util
Class TimeoutController

    java.lang.Object
      org.apache.commons.httpclient.util.TimeoutController

    public final class TimeoutController

extends Object

Executes a task with a specified timeout.

Since:
  2.0
Version:
  $Revision: 480424 $
Author:
  Ortwin Glueck, Mike Bowler

Nested Class Summary
`static class` | `TimeoutController.TimeoutException` Signals that the task timed out.

Method Summary
`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`.

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Method Detail

### 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().

  Parameters:
    `task` - The thread to execute
    `timeout` - The timeout in milliseconds. 0 means to wait forever.
  Throws:
    `TimeoutController.TimeoutException` - if the timeout passes and the thread does not return.

### execute

    public static void execute(Runnable task,
                               long timeout)
                        throws TimeoutController.TimeoutException

  Executes `task` in a new deamon Thread and waits for the timeout.

  Parameters:
    `task` - The task to execute
    `timeout` - The timeout in milliseconds. 0 means to wait forever.
  Throws:
    `TimeoutController.TimeoutException` - if the timeout passes and the thread does not return.

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright © 2001-2007 Apache Software Foundation. All Rights Reserved.