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

## net.i2p.util
Class SimpleTimer

    java.lang.Object
      net.i2p.util.SimpleTimer

Direct Known Subclasses:
  FlushTimer

    public class SimpleTimer

extends Object

Simple event scheduler - toss an event on the queue and it gets fired at the appropriate time. The method that is fired however should NOT block (otherwise they b0rk the timer).

Nested Class Summary
`static interface` | `SimpleTimer.TimedEvent` Simple interface for events to be queued up and notified on expiration

Constructor Summary
`protected` | `SimpleTimer()`
`protected` | `SimpleTimer(String name)`

Method Summary
`void` | `addEvent(SimpleTimer.TimedEvent event, long timeoutMs)` Queue up the given event to be fired no sooner than timeoutMs from now.
`void` | `addEvent(SimpleTimer.TimedEvent event, long timeoutMs, boolean useEarliestTime)`
`static SimpleTimer` | `getInstance()`
`boolean` | `removeEvent(SimpleTimer.TimedEvent evt)`
`void` | `removeSimpleTimer()` Removes the SimpleTimer.
`void` | `reschedule(SimpleTimer.TimedEvent event, long timeoutMs)`

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

Constructor Detail

### SimpleTimer

    protected SimpleTimer()

### SimpleTimer

    protected SimpleTimer(String name)

Method Detail

### getInstance

    public static SimpleTimer getInstance()

### removeSimpleTimer

    public void removeSimpleTimer()

  Removes the SimpleTimer.

### reschedule

    public void reschedule(SimpleTimer.TimedEvent event,
                           long timeoutMs)

  Parameters:
    `event` -
    `timeoutMs` -

### addEvent

    public void addEvent(SimpleTimer.TimedEvent event,
                         long timeoutMs)

  Queue up the given event to be fired no sooner than timeoutMs from now. However, if this event is already scheduled, the event will be scheduled for the earlier of the two timeouts, which may be before this stated timeout. If this is not the desired behavior, call removeEvent first.

  Parameters:
    `event` -
    `timeoutMs` -

### addEvent

    public void addEvent(SimpleTimer.TimedEvent event,
                         long timeoutMs,
                         boolean useEarliestTime)

  Parameters:
    `event` -
    `timeoutMs` -
    `useEarliestTime` - if its already scheduled, use the earlier of the two timeouts, else use the later

### removeEvent

    public boolean removeEvent(SimpleTimer.TimedEvent evt)

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