de.nava.informa.utils.toolkit
Class Scheduler

java.lang.Object
  extended by de.nava.informa.utils.toolkit.Scheduler

public class Scheduler
extends Object

Scheduler of channel-related events. It uses Timer object to build events firing plan. Using this class it is possible to scheduler big number of events related to different channels with individual period and priority settings. It is also possible to unsechedule processing of channels, reschedule to another period and request immediate firing of processing event with consequent rebuilding of events plan.

Author:
Aleksey Gureev (spyromus@noizeramp.com)

Constructor Summary
Scheduler(SchedulerCallbackIF callback)
          Creates scheduler object.
 
Method Summary
 void rescheduleAll(long period)
          Reschedules all of the tasks with new period setting.
 void rescheduleChannel(ChannelIF channel, long period)
          Reschedules single channel.
 void schedule(ChannelIF channel, long period, int priority)
          Schedule single channel for poller.
 void schedule(ChannelIF channel, long delay, long period, int priority)
          Schedule single channel for poller.
 void triggerNow(ChannelIF channel)
          Triggers channel event immediately (if it is registered) and reschedules consequent events.
 void unschedule(ChannelIF channel)
          Stop poller the channel.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Scheduler

public Scheduler(SchedulerCallbackIF callback)
Creates scheduler object.

Parameters:
callback - callback object.
Method Detail

schedule

public final void schedule(ChannelIF channel,
                           long period,
                           int priority)
Schedule single channel for poller.

Parameters:
channel - channel to schedule for poller.
period - period of poller.
priority - priority of the task.

schedule

public final void schedule(ChannelIF channel,
                           long delay,
                           long period,
                           int priority)
Schedule single channel for poller.

Parameters:
channel - channel to schedule for poller.
delay - delay before first polling.
period - period of poller.
priority - priority of the task.

unschedule

public final void unschedule(ChannelIF channel)
Stop poller the channel.

Parameters:
channel - channel to poll no more.

triggerNow

public final void triggerNow(ChannelIF channel)
Triggers channel event immediately (if it is registered) and reschedules consequent events.

Parameters:
channel - channel.

rescheduleAll

public final void rescheduleAll(long period)
Reschedules all of the tasks with new period setting.

Parameters:
period - period in millis.

rescheduleChannel

public final void rescheduleChannel(ChannelIF channel,
                                    long period)
Reschedules single channel. If channel isn't registered yet it will be registered with normal priority.

Parameters:
channel - channel.
period - new period.


Copyright © 2002-2007 Niko Schmuck. All Rights Reserved.