Package net.i2p.util

Class SimpleScheduler


  • @Deprecated
    public class SimpleScheduler
    extends Object
    Deprecated.
    in 0.9.20, use SimpleTimer2 instead
    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 Detail

      • SimpleScheduler

        @Deprecated
        public SimpleScheduler​(I2PAppContext context)
        Deprecated.
        in 0.9.20, replaced by SimpleTimer2
        To be instantiated by the context. Others should use context.simpleTimer() instead
    • Method Detail

      • getInstance

        @Deprecated
        public static SimpleScheduler getInstance()
        Deprecated.
        in 0.9.20, replaced by SimpleTimer2
        If you have a context, use context.simpleScheduler() instead
      • stop

        public void stop()
        Deprecated.
        Stops the SimpleScheduler. Subsequent executions should not throw a RejectedExecutionException.
      • addEvent

        public void addEvent​(SimpleTimer.TimedEvent event,
                             long timeoutMs)
        Deprecated.
        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)
        Deprecated.
        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)
        Deprecated.
        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 -