## net.i2p.util
Class SimpleScheduler

    java.lang.Object
      net.i2p.util.SimpleScheduler

    public class SimpleScheduler

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). This is like SimpleTimer but addEvent() for an existing event adds a second job. Unlike SimpleTimer, events cannot be cancelled or rescheduled. For events that cannot or will not be cancelled or rescheduled - for example, a call such as: SimpleTimer.getInstance().addEvent(new FooEvent(bar), timeoutMs); use SimpleScheduler instead to reduce lock contention in SimpleTimer... For periodic events, use addPeriodicEvent(). Unlike SimpleTimer, uncaught Exceptions will not prevent subsequent executions.

Author:
  zzz

Constructor Summary
`protected` `SimpleScheduler()`
`protected` `SimpleScheduler(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` `addPeriodicEvent(SimpleTimer.TimedEvent event, long timeoutMs)` Queue up the given event to be fired after timeoutMs and every timeoutMs thereafter.
`void` `addPeriodicEvent(SimpleTimer.TimedEvent event, long initialDelay, long timeoutMs)` Queue up the given event to be fired after initialDelay and every timeoutMs thereafter.
`static SimpleScheduler` `getInstance()`
`void` `stop()` Removes the SimpleScheduler.

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

Constructor Detail

### SimpleScheduler

    protected SimpleScheduler()

### SimpleScheduler

    protected SimpleScheduler(String name)

Method Detail

### getInstance

    public static SimpleScheduler getInstance()

### stop

    public void stop()

  Removes the SimpleScheduler.

### addEvent

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

  Queue up the given event to be fired no sooner than timeoutMs from now.

  Parameters:
    `event` -
    `timeoutMs` -

### addPeriodicEvent

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

  Queue up the given event to be fired after timeoutMs and every timeoutMs thereafter. The TimedEvent must not do its own rescheduling. As all Exceptions are caught in run(), these will not prevent subsequent executions (unlike SimpleTimer, where the TimedEvent does its own rescheduling).

### addPeriodicEvent

    public void addPeriodicEvent(SimpleTimer.TimedEvent event,
                                 long initialDelay,
                                 long timeoutMs)

  Queue up the given event to be fired after initialDelay and every timeoutMs thereafter. The TimedEvent must not do its own rescheduling. As all Exceptions are caught in run(), these will not prevent subsequent executions (unlike SimpleTimer, where the TimedEvent does its own rescheduling)

  Parameters:
    `event` -
    `initialDelay` - (ms)
    `timeoutMs` -