org.eclipse.jetty.util.thread

## Class Timeout.Task

- java.lang.Object
- - org.eclipse.jetty.util.thread.Timeout.Task

- Direct Known Subclasses:
    AsyncContinuation.AsyncEventState
  Enclosing class:
    Timeout

      public static class Timeout.Task
      extends Object

  Task. The base class for scheduled timeouts. This class should be extended to implement the expire() method, which is called if the timeout expires.

- - ### Constructor Summary

    Constructors
    Modifier | Constructor and Description
    --- | ---
    `protected` | `Timeout.Task()`

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `cancel()` Cancel the task.
    `protected void` | `expire()` Expire task.
    `void` | `expired()` Expire task.
    `long` | `getAge()`
    `long` | `getTimestamp()`
    `boolean` | `isExpired()`
    `boolean` | `isScheduled()`
    `void` | `reschedule()` Reschedule the task on the current timeout.
    `void` | `schedule(Timeout timer)` Schedule the task on the given timeout.
    `void` | `schedule(Timeout timer, long delay)` Schedule the task on the given timeout.

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Constructor Detail

    - #### Timeout.Task

          protected Timeout.Task()

  - ### Method Detail

    - #### getTimestamp

          public long getTimestamp()

    - #### getAge

          public long getAge()

    - #### schedule

          public void schedule(Timeout timer)

      Schedule the task on the given timeout. The task exiry will be called after the timeout duration.
      Parameters:
        `timer` -

    - #### schedule

          public void schedule(Timeout timer,
                      long delay)

      Schedule the task on the given timeout. The task exiry will be called after the timeout duration.
      Parameters:
        `timer` -

    - #### reschedule

          public void reschedule()

      Reschedule the task on the current timeout. The task timeout is rescheduled as if it had been cancelled and scheduled on the current timeout.

    - #### cancel

          public void cancel()

      Cancel the task. Remove the task from the timeout.

    - #### isExpired

          public boolean isExpired()

    - #### isScheduled

          public boolean isScheduled()

    - #### expire

          protected void expire()

      Expire task. This method is called when the timeout expires. It is called in the scope of the synchronize block (on this) that sets the `isExpired()` state to true.
      See Also:
        `For an unsynchronized callback.`

    - #### expired

          public void expired()

      Expire task. This method is called when the timeout expires. It is called outside of any synchronization scope and may be delayed.

Copyright © 1995-2012 Mort Bay Consulting. All Rights Reserved.