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.mortbay.thread
Class Timeout

    java.lang.Object
      org.mortbay.thread.Timeout

    public class Timeout

extends java.lang.Object

Timeout queue. This class implements a timeout queue for timers that are at least as likely to be cancelled as they are to expire. Unlike the util timeout class, the duration of the timeouts is shared by all scheduled tasks and if the duration is changed, this affects all scheduled tasks.

The nested class Task should be extended by users of this class to obtain call back notification of expiries.

Author:
  gregw

Nested Class Summary
`static class` | `Timeout.Task` Task.

Constructor Summary
`Timeout()`
`Timeout(java.lang.Object lock)`

Method Summary
`void` | `cancelAll()`
`Timeout.Task` | `expired()` Get an expired tasks.
`long` | `getDuration()`
`long` | `getNow()`
`long` | `getTimeToNext()`
`boolean` | `isEmpty()`
`void` | `schedule(Timeout.Task task)`
`void` | `schedule(Timeout.Task task, long delay)`
`void` | `setDuration(long duration)`
`long` | `setNow()`
`void` | `setNow(long now)`
`void` | `tick()`
`void` | `tick(long now)`
`java.lang.String` | `toString()`

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

Constructor Detail

### Timeout

    public Timeout()

### Timeout

    public Timeout(java.lang.Object lock)

Method Detail

### getDuration

    public long getDuration()

  Returns:
    Returns the duration.

### setDuration

    public void setDuration(long duration)

  Parameters:
    `duration` - The duration to set.

### setNow

    public long setNow()

### getNow

    public long getNow()

### setNow

    public void setNow(long now)

### expired

    public Timeout.Task expired()

  Get an expired tasks. This is called instead of `tick()` to obtain the next expired Task, but without calling it's `Timeout.Task.expire()` or `Timeout.Task.expired()` methods.

### tick

    public void tick()

### tick

    public void tick(long now)

### schedule

    public void schedule(Timeout.Task task)

### schedule

    public void schedule(Timeout.Task task,
                         long delay)

  Parameters:
    `task` -
    `delay` - A delay in addition to the default duration of the timeout

### cancelAll

    public void cancelAll()

### isEmpty

    public boolean isEmpty()

### getTimeToNext

    public long getTimeToNext()

### toString

    public java.lang.String toString()

  Overrides:
    `toString` in class `java.lang.Object`

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 © 1995-2010 Mort Bay Consulting. All Rights Reserved.