Class ScheduledJob
java.lang.Object
net.solarnetwork.central.scheduler.BasicJobInfo
net.solarnetwork.central.scheduler.ScheduledJob
A scheduled task.
-
Constructor Summary
ConstructorsConstructorDescriptionScheduledJob(JobKey key, Runnable task, org.springframework.scheduling.Trigger trigger) Constructor. -
Method Summary
Modifier and TypeMethodDescriptionJob future.Get the status of this job.getKey()Get the job key.Get the last completion time.Get the next execution time of the job.Get the previous execution time of the job.org.springframework.scheduling.TriggerGet the trigger.booleanFlag indicating the job is currently executing.booleanisPaused()Get the paused flag.voidrun()voidsetFuture(ScheduledFuture<?> future) Set the job future.voidsetPaused(boolean paused) Set the paused flag.Methods inherited from class net.solarnetwork.central.scheduler.BasicJobInfo
getExecutionScheduleDescription, getGroupId, getId
-
Constructor Details
-
ScheduledJob
Constructor.- Parameters:
task- the job tasktrigger- the job triggergroupId- the group IDid- the job ID- Throws:
IllegalArgumentException- if any argument is null
-
-
Method Details
-
run
public void run() -
getJobStatus
Description copied from interface:JobInfoGet the status of this job.- Specified by:
getJobStatusin interfaceJobInfo- Overrides:
getJobStatusin classBasicJobInfo- Returns:
- the job status
-
isExecuting
public boolean isExecuting()Description copied from interface:JobInfoFlag indicating the job is currently executing.- Specified by:
isExecutingin interfaceJobInfo- Overrides:
isExecutingin classBasicJobInfo- Returns:
- true if the job is executing
-
getPreviousExecutionTime
Description copied from interface:JobInfoGet the previous execution time of the job.If the job is currently executing, this value represents the time the job started.
- Specified by:
getPreviousExecutionTimein interfaceJobInfo- Overrides:
getPreviousExecutionTimein classBasicJobInfo- Returns:
- the previous execution time, or null if the job has never run before
-
getNextExecutionTime
Description copied from interface:JobInfoGet the next execution time of the job.- Specified by:
getNextExecutionTimein interfaceJobInfo- Overrides:
getNextExecutionTimein classBasicJobInfo- Returns:
- the next execution time, or null if no more executions are scheduled
-
getKey
Get the job key.- Returns:
- the job key
-
getTrigger
public org.springframework.scheduling.Trigger getTrigger()Get the trigger.- Returns:
- the trigger
-
getLastCompletionTime
Get the last completion time.- Returns:
- the last completion time, or null if never completed
-
isPaused
public boolean isPaused()Get the paused flag.- Returns:
- true if this job is paused
-
setPaused
public void setPaused(boolean paused) Set the paused flag.- Parameters:
paused- true if this job is paused
-
getFuture
Job future.- Returns:
- the job future
-
setFuture
Set the job future.- Parameters:
future- the job future
-