public class Scheduler extends Object implements Serializable
Modifier and Type | Class and Description |
---|---|
class |
Scheduler.WakeUp |
Modifier and Type | Field and Description |
---|---|
private ScheduleItem |
items
events list
|
static Logger |
logger |
private static long |
serialVersionUID
define serialVersionUID for interoperability
|
private Timer |
timer
the timer
|
private Scheduler.WakeUp |
wakeUp
Current task schedule in Timer
|
Constructor and Description |
---|
Scheduler(Timer timer)
Creates the default scheduler.
|
Modifier and Type | Method and Description |
---|---|
private void |
cancel()
cancel a wake up task in timer.
|
private void |
checkItems()
Checks for ripe events.
|
private void |
insertItem(ScheduleEvent event,
ScheduleTask task)
insertItem
ScheduleEvent event. |
private void |
insertItem(ScheduleItem newItem)
Inserts an item in the list ordered by date.
|
private void |
readObject(ObjectInputStream in) |
private void |
removeItem(ScheduleItem item)
Removes an item from the list.
|
void |
restart(Timer timer)
restart scheduler.
|
private void |
schedule(ScheduleEvent event,
long period)
schedule wake up task in timer.
|
void |
scheduleEvent(ScheduleEvent event,
ScheduleTask task)
schedule an event.
|
String |
toString()
Provides a string image for this object.
|
private void |
writeObject(ObjectOutputStream out) |
private static final long serialVersionUID
public static Logger logger
private transient ScheduleItem items
private transient Timer timer
private transient Scheduler.WakeUp wakeUp
public Scheduler(Timer timer) throws IOException
timer
- a ScalAgent timer.IOException
public void restart(Timer timer) throws Exception
timer
- a ScalAgent timer.Exception
public String toString()
public void scheduleEvent(ScheduleEvent event, ScheduleTask task) throws Exception
insertItem
.
Calls checkItems
.event
- event to schedule.task
- task to execute.Exception
private void insertItem(ScheduleEvent event, ScheduleTask task)
ScheduleEvent
event.event
- task
- task to execute.private void insertItem(ScheduleItem newItem)
newItem
- item to insertprivate void checkItems() throws Exception
Exception
private void removeItem(ScheduleItem item)
item
- item to removeprivate void schedule(ScheduleEvent event, long period)
event
- schedule event.period
- period in ms.private void cancel()
private void writeObject(ObjectOutputStream out) throws IOException
IOException
private void readObject(ObjectInputStream in) throws IOException, ClassNotFoundException
IOException
ClassNotFoundException
Copyright © 2023 ScalAgent D.T.. All rights reserved.