Package de.mhus.lib.core.schedule
Class CronJob
- java.lang.Object
-
- java.util.TimerTask
-
- de.mhus.lib.core.MTimerTask
-
- de.mhus.lib.core.schedule.SchedulerJob
-
- de.mhus.lib.core.schedule.CronJob
-
- All Implemented Interfaces:
de.mhus.lib.basics.Named,ITimerTask,MutableSchedulerJob,Operation,MNlsProvider,Nls,Runnable
public class CronJob extends SchedulerJob implements MutableSchedulerJob
Schedule tasks like Crontab (man -S 5 crontab). Next scheduling is done after execution of a task. Example * * * * * every minute, field allowed values ----- -------------- minute 0-59 hour 0-23 day of month 1-31 month 1-12 (or names, see below) day of week 1-7 (1 is Sunday) specials w = only working days disabled = disabled by default- Author:
- mikehummel
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classCronJob.Definition-
Nested classes/interfaces inherited from class de.mhus.lib.core.schedule.SchedulerJob
SchedulerJob.MyTaskContext
-
-
Field Summary
-
Fields inherited from class de.mhus.lib.core.schedule.SchedulerJob
CALCULATE_NEXT, context, DISABLED_TIME, log, REMOVE_TIME
-
Fields inherited from class de.mhus.lib.core.MTimerTask
CANCELLED, environment, EXECUTED, SCHEDULED, UNKNOWN, VIRGIN
-
-
Constructor Summary
Constructors Constructor Description CronJob(String definition, ITimerTask task)CronJob(String name, CronJob.Definition definition, boolean restrictive, ITimerTask task)CronJob(String name, String definition, boolean restrictive, ITimerTask task)CronJob(String name, String definition, ITimerTask task)CronJob(String minute, String hour, String dayOfMonth, String month, String dayOfWeek, ITimerTask task)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voiddoCaclulateNextExecution()Calculate the next executionTime and store it into nextExecutionTimebooleandoReconfigure(String config)Reconfigure the scheduler.voiddoReschedule(Scheduler queue, long time)protected booleanisExecutionTimeReached()By default the function will compare the nextExecutionTime with the current time.booleanisRestrictive()voidsetDone(boolean done)voidsetRestrictive(boolean restrictive)voidsetScheduledTime(long scheduledTime)StringtoString()-
Methods inherited from class de.mhus.lib.core.schedule.SchedulerJob
canExecute, doError, doExecute, doExecute2, doit, doSchedule, doTick, doTimeoutReached, getDescription, getInfo, getIntercepter, getLastExecutionStart, getLastExecutionStop, getLogTrailConfig, getNextExecutionTime, getNls, getOwner, getScheduledTime, getTask, getThread, getTimeoutInMinutes, getUuid, hasAccess, isBusy, isDone, nls, releaseBusy, setBusy, setInfo, setIntercepter, setLogTrailConfig, setNextExecutionTime, setTask, setTimeoutInMinutes
-
Methods inherited from class de.mhus.lib.core.MTimerTask
cancel, getName, getStatus, isCanceled, onError, onFinal, run, run, setCanceled, setName
-
Methods inherited from class java.util.TimerTask
scheduledExecutionTime
-
-
-
-
Constructor Detail
-
CronJob
public CronJob(String name, CronJob.Definition definition, boolean restrictive, ITimerTask task)
-
CronJob
public CronJob(String minute, String hour, String dayOfMonth, String month, String dayOfWeek, ITimerTask task)
-
CronJob
public CronJob(String definition, ITimerTask task)
-
CronJob
public CronJob(String name, String definition, ITimerTask task)
-
CronJob
public CronJob(String name, String definition, boolean restrictive, ITimerTask task)
-
-
Method Detail
-
doCaclulateNextExecution
public void doCaclulateNextExecution()
Description copied from class:SchedulerJobCalculate the next executionTime and store it into nextExecutionTime- Specified by:
doCaclulateNextExecutionin classSchedulerJob
-
isExecutionTimeReached
protected boolean isExecutionTimeReached()
Description copied from class:SchedulerJobBy default the function will compare the nextExecutionTime with the current time. If the time is come it will return true. If nextExecutionTime is 0 or less it will return false in every case.- Overrides:
isExecutionTimeReachedin classSchedulerJob- Returns:
-
isRestrictive
public boolean isRestrictive()
-
setRestrictive
public void setRestrictive(boolean restrictive)
-
toString
public String toString()
- Overrides:
toStringin classSchedulerJob
-
doReschedule
public void doReschedule(Scheduler queue, long time)
- Specified by:
doReschedulein interfaceMutableSchedulerJob- Overrides:
doReschedulein classSchedulerJob
-
setDone
public void setDone(boolean done)
- Specified by:
setDonein interfaceMutableSchedulerJob- Overrides:
setDonein classSchedulerJob
-
doReconfigure
public boolean doReconfigure(String config)
Description copied from interface:MutableSchedulerJobReconfigure the scheduler. Returns true if it was successful.- Specified by:
doReconfigurein interfaceMutableSchedulerJob- Returns:
- true if successful
-
setScheduledTime
public void setScheduledTime(long scheduledTime)
- Specified by:
setScheduledTimein interfaceMutableSchedulerJob- Overrides:
setScheduledTimein classSchedulerJob
-
-