Class ScheduledJob

java.lang.Object
net.solarnetwork.central.scheduler.BasicJobInfo
net.solarnetwork.central.scheduler.ScheduledJob
All Implemented Interfaces:
Runnable, JobInfo

public class ScheduledJob extends BasicJobInfo implements Runnable
A scheduled task.
  • Constructor Details

    • ScheduledJob

      public ScheduledJob(JobKey key, Runnable task, org.springframework.scheduling.Trigger trigger)
      Constructor.
      Parameters:
      task - the job task
      trigger - the job trigger
      groupId - the group ID
      id - the job ID
      Throws:
      IllegalArgumentException - if any argument is null
  • Method Details

    • run

      public void run()
      Specified by:
      run in interface Runnable
    • getJobStatus

      public JobStatus getJobStatus()
      Description copied from interface: JobInfo
      Get the status of this job.
      Specified by:
      getJobStatus in interface JobInfo
      Overrides:
      getJobStatus in class BasicJobInfo
      Returns:
      the job status
    • isExecuting

      public boolean isExecuting()
      Description copied from interface: JobInfo
      Flag indicating the job is currently executing.
      Specified by:
      isExecuting in interface JobInfo
      Overrides:
      isExecuting in class BasicJobInfo
      Returns:
      true if the job is executing
    • getPreviousExecutionTime

      public Instant getPreviousExecutionTime()
      Description copied from interface: JobInfo
      Get the previous execution time of the job.

      If the job is currently executing, this value represents the time the job started.

      Specified by:
      getPreviousExecutionTime in interface JobInfo
      Overrides:
      getPreviousExecutionTime in class BasicJobInfo
      Returns:
      the previous execution time, or null if the job has never run before
    • getNextExecutionTime

      public Instant getNextExecutionTime()
      Description copied from interface: JobInfo
      Get the next execution time of the job.
      Specified by:
      getNextExecutionTime in interface JobInfo
      Overrides:
      getNextExecutionTime in class BasicJobInfo
      Returns:
      the next execution time, or null if no more executions are scheduled
    • getKey

      public JobKey getKey()
      Get the job key.
      Returns:
      the job key
    • getTrigger

      public org.springframework.scheduling.Trigger getTrigger()
      Get the trigger.
      Returns:
      the trigger
    • getLastCompletionTime

      public Instant 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

      public ScheduledFuture<?> getFuture()
      Job future.
      Returns:
      the job future
    • setFuture

      public void setFuture(ScheduledFuture<?> future)
      Set the job future.
      Parameters:
      future - the job future