public abstract class SchedulerJob extends MTimerTask implements Operation
Abstract SchedulerJob class.
| Modifier and Type | Class and Description |
|---|---|
protected static class |
SchedulerJob.MyTaskContext |
| Modifier and Type | Field and Description |
|---|---|
static long |
CALCULATE_NEXT
Constant
CALCULATE_NEXT=0 |
protected SchedulerJob.MyTaskContext |
context |
static long |
DISABLED_TIME
Constant
DISABLED_TIME=-1 |
protected static Log |
log
Constant
log |
static long |
REMOVE_TIME
Constant
REMOVE_TIME=-2 |
| Constructor and Description |
|---|
SchedulerJob(Observer task)
Constructor for SchedulerJob.
|
SchedulerJob(String name,
Observer task)
Constructor for SchedulerJob.
|
| Modifier and Type | Method and Description |
|---|---|
boolean |
canExecute(TaskContext context)
canExecute.
|
protected abstract void |
doCaclulateNextExecution()
Calculate the next executionTime and store it into nextExecutionTime
|
protected void |
doError(Throwable t)
doError.
|
OperationResult |
doExecute(TaskContext context)
doExecute.
|
protected OperationResult |
doExecute2(TaskContext context)
doExecute2.
|
void |
doit()
doit.
|
protected void |
doReschedule(Scheduler scheduler,
long time)
doReschedule.
|
protected void |
doSchedule(Scheduler scheduler)
doSchedule.
|
void |
doTick()
Call this method to fire ticks to the scheduler.
|
void |
doTimeoutReached()
If you have defined a timeout, the event will be called every minute.
|
OperationDescription |
getDescription()
getDescription.
|
long |
getLastExecutionStart()
Getter for the field
lastExecutionStart. |
long |
getLastExecutionStop()
Getter for the field
lastExecutionStop. |
long |
getNextExecutionTime()
Getter for the field
nextExecutionTime. |
Object |
getOwner()
Getter for the field
owner. |
long |
getScheduledTime()
Getter for the field
scheduledTime. |
Observer |
getTask()
Getter for the field
task. |
Thread |
getThread()
Getter for the field
thread. |
long |
getTimeoutInMinutes()
Getter for the field
timeoutInMinutes. |
boolean |
hasAccess()
hasAccess.
|
boolean |
isBusy()
isBusy.
|
boolean |
isDone()
isDone.
|
protected boolean |
isExecutionTimeReached()
By default the function will compare the nextExecutionTime with the current time.
|
boolean |
releaseBusy(Object owner)
releaseBusy.
|
boolean |
setBusy(Object owner)
setBusy.
|
protected void |
setDone(boolean done)
Setter for the field
done. |
void |
setNextExecutionTime(long nextExecutionTime)
Setter for the field
nextExecutionTime. |
protected void |
setScheduledTime(long scheduledTime)
Setter for the field
scheduledTime. |
protected void |
setTask(Observer task)
Setter for the field
task. |
void |
setTimeoutInMinutes(long timeoutInMinutes)
Setter for the field
timeoutInMinutes. |
String |
toString() |
cancel, getName, isCanceled, onError, onFinal, run, setCanceled, setName, updatescheduledExecutionTimepublic static final long CALCULATE_NEXT
CALCULATE_NEXT=0public static final long DISABLED_TIME
DISABLED_TIME=-1public static final long REMOVE_TIME
REMOVE_TIME=-2protected static Log log
logprotected SchedulerJob.MyTaskContext context
public SchedulerJob(Observer task)
Constructor for SchedulerJob.
task - a Observer object.public void doTick()
protected abstract void doCaclulateNextExecution()
public final OperationResult doExecute(TaskContext context) throws Exception
doExecute.
doExecute in interface Operationcontext - a TaskContext object.OperationResult object.Exception - if any.protected OperationResult doExecute2(TaskContext context) throws Exception
doExecute2.
context - a TaskContext object.OperationResult object.Exception - if any.public boolean isBusy()
isBusy.
public boolean setBusy(Object owner)
setBusy.
public boolean releaseBusy(Object owner)
releaseBusy.
releaseBusy in interface Operationowner - a Object object.protected boolean isExecutionTimeReached()
public boolean isDone()
isDone.
protected void setDone(boolean done)
Setter for the field done.
done - a boolean.public boolean hasAccess()
hasAccess.
public boolean canExecute(TaskContext context)
canExecute.
canExecute in interface Operationcontext - a TaskContext object.public OperationDescription getDescription()
getDescription.
getDescription in interface OperationOperationDescription object.protected void setTask(Observer task)
Setter for the field task.
task - a Observer object.public void doit()
throws Exception
doit.
doit in class MTimerTaskException - if any.public long getNextExecutionTime()
Getter for the field nextExecutionTime.
protected void doSchedule(Scheduler scheduler)
doSchedule.
scheduler - a Scheduler object.protected void doReschedule(Scheduler scheduler, long time)
doReschedule.
scheduler - a Scheduler object.time - a long.public long getLastExecutionStart()
Getter for the field lastExecutionStart.
public long getLastExecutionStop()
Getter for the field lastExecutionStop.
public long getScheduledTime()
Getter for the field scheduledTime.
protected void setScheduledTime(long scheduledTime)
Setter for the field scheduledTime.
scheduledTime - a long.public long getTimeoutInMinutes()
Getter for the field timeoutInMinutes.
public void setTimeoutInMinutes(long timeoutInMinutes)
Setter for the field timeoutInMinutes.
timeoutInMinutes - a long.public void doTimeoutReached()
public void setNextExecutionTime(long nextExecutionTime)
Setter for the field nextExecutionTime.
nextExecutionTime - a long.Copyright © 2016. All Rights Reserved.