Package de.mhus.lib.core.schedule
Class SchedulerJobProxy
- java.lang.Object
-
- java.util.TimerTask
-
- de.mhus.lib.core.MTimerTask
-
- de.mhus.lib.core.schedule.SchedulerJob
-
- de.mhus.lib.core.schedule.SchedulerJobProxy
-
- All Implemented Interfaces:
de.mhus.lib.basics.Named,ITimerTask,MutableSchedulerJob,Operation,MNlsProvider,Nls,Runnable
public class SchedulerJobProxy extends SchedulerJob implements MutableSchedulerJob
-
-
Nested Class Summary
-
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 SchedulerJobProxy(SchedulerJob instance)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description booleancancel()booleancanExecute(TaskContext context)protected voiddoCaclulateNextExecution()Calculate the next executionTime and store it into nextExecutionTimeprotected voiddoError(Throwable t)protected OperationResultdoExecute2(TaskContext context)voiddoit()booleandoReconfigure(String config)Reconfigure the scheduler.voiddoReschedule(Scheduler scheduler, long time)voiddoTick(boolean forced)Call this method to fire ticks to the scheduler.voiddoTimeoutReached()If you have defined a timeout, the event will be called every minute.OperationDescriptiongetDescription()longgetLastExecutionStart()longgetLastExecutionStop()StringgetName()longgetNextExecutionTime()ObjectgetOwner()longgetScheduledTime()ITimerTaskgetTask()longgetTimeoutInMinutes()booleanhasAccess()booleanisBusy()booleanisCanceled()booleanisDone()protected booleanisExecutionTimeReached()By default the function will compare the nextExecutionTime with the current time.booleanreleaseBusy(Object owner)longscheduledExecutionTime()booleansetBusy(Object owner)voidsetCanceled(boolean canceled)voidsetDone(boolean done)voidsetNextExecutionTime(long nextExecutionTime)voidsetScheduledTime(long scheduledTime)voidsetTimeoutInMinutes(long timeoutInMinutes)StringtoString()-
Methods inherited from class de.mhus.lib.core.schedule.SchedulerJob
doExecute, doSchedule, getInfo, getIntercepter, getLogTrailConfig, getNls, getThread, getUuid, nls, setInfo, setIntercepter, setLogTrailConfig, setTask
-
-
-
-
Constructor Detail
-
SchedulerJobProxy
public SchedulerJobProxy(SchedulerJob instance)
-
-
Method Detail
-
doTick
public void doTick(boolean forced)
Description copied from class:SchedulerJobCall this method to fire ticks to the scheduler. If the time is come the scheduler will execute the operation and set 'done' to true.- Overrides:
doTickin classSchedulerJob
-
cancel
public boolean cancel()
- Overrides:
cancelin classMTimerTask
-
isCanceled
public boolean isCanceled()
- Specified by:
isCanceledin interfaceITimerTask- Overrides:
isCanceledin classMTimerTask
-
isBusy
public boolean isBusy()
- Specified by:
isBusyin interfaceOperation- Overrides:
isBusyin classSchedulerJob
-
setBusy
public boolean setBusy(Object owner)
- Specified by:
setBusyin interfaceOperation- Overrides:
setBusyin classSchedulerJob
-
releaseBusy
public boolean releaseBusy(Object owner)
- Specified by:
releaseBusyin interfaceOperation- Overrides:
releaseBusyin classSchedulerJob
-
scheduledExecutionTime
public long scheduledExecutionTime()
- Overrides:
scheduledExecutionTimein classTimerTask
-
getOwner
public Object getOwner()
- Overrides:
getOwnerin classSchedulerJob
-
isDone
public boolean isDone()
- Overrides:
isDonein classSchedulerJob
-
hasAccess
public boolean hasAccess()
- Specified by:
hasAccessin interfaceOperation- Overrides:
hasAccessin classSchedulerJob
-
canExecute
public boolean canExecute(TaskContext context)
- Specified by:
canExecutein interfaceOperation- Overrides:
canExecutein classSchedulerJob
-
getDescription
public OperationDescription getDescription()
- Specified by:
getDescriptionin interfaceOperation- Overrides:
getDescriptionin classSchedulerJob
-
getTask
public ITimerTask getTask()
- Overrides:
getTaskin classSchedulerJob
-
doit
public void doit() throws Exception- Overrides:
doitin classSchedulerJob- Throws:
Exception
-
getNextExecutionTime
public long getNextExecutionTime()
- Overrides:
getNextExecutionTimein classSchedulerJob
-
getName
public String getName()
- Specified by:
getNamein interfacede.mhus.lib.basics.Named- Overrides:
getNamein classMTimerTask
-
getLastExecutionStart
public long getLastExecutionStart()
- Overrides:
getLastExecutionStartin classSchedulerJob
-
getLastExecutionStop
public long getLastExecutionStop()
- Overrides:
getLastExecutionStopin classSchedulerJob
-
getScheduledTime
public long getScheduledTime()
- Overrides:
getScheduledTimein classSchedulerJob
-
toString
public String toString()
- Overrides:
toStringin classSchedulerJob
-
getTimeoutInMinutes
public long getTimeoutInMinutes()
- Overrides:
getTimeoutInMinutesin classSchedulerJob
-
setTimeoutInMinutes
public void setTimeoutInMinutes(long timeoutInMinutes)
- Overrides:
setTimeoutInMinutesin classSchedulerJob
-
doTimeoutReached
public void doTimeoutReached()
Description copied from class:SchedulerJobIf you have defined a timeout, the event will be called every minute. Be carefully with the execution time of this event, it can hem the hole scheduler.- Overrides:
doTimeoutReachedin classSchedulerJob
-
doCaclulateNextExecution
protected void doCaclulateNextExecution()
Description copied from class:SchedulerJobCalculate the next executionTime and store it into nextExecutionTime- Specified by:
doCaclulateNextExecutionin classSchedulerJob
-
setCanceled
public void setCanceled(boolean canceled)
- Overrides:
setCanceledin classMTimerTask
-
doReschedule
public void doReschedule(Scheduler scheduler, long time)
- Specified by:
doReschedulein interfaceMutableSchedulerJob- Overrides:
doReschedulein classSchedulerJob
-
doError
protected void doError(Throwable t)
- Overrides:
doErrorin classSchedulerJob
-
setDone
public void setDone(boolean done)
- Specified by:
setDonein interfaceMutableSchedulerJob- Overrides:
setDonein 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:
-
doExecute2
protected OperationResult doExecute2(TaskContext context) throws Exception
- Overrides:
doExecute2in classSchedulerJob- Throws:
Exception
-
setNextExecutionTime
public void setNextExecutionTime(long nextExecutionTime)
- Overrides:
setNextExecutionTimein classSchedulerJob
-
setScheduledTime
public void setScheduledTime(long scheduledTime)
- Specified by:
setScheduledTimein interfaceMutableSchedulerJob- Overrides:
setScheduledTimein 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
-
-