Klasse AbstractSchedulerService

Alle implementierten Schnittstellen:
Initable, ScheduleService, Service
Bekannte direkte Unterklassen:
TorqueSchedulerService, TurbineNonPersistentSchedulerService

public abstract class AbstractSchedulerService extends TurbineBaseService implements ScheduleService
Service for a cron like scheduler.
Version:
$Id: TorqueSchedulerService.java 534527 2007-05-02 16:10:59Z tv $
Autor:
Dave Bryson, Quinton McCombs
  • Felddetails

  • Konstruktordetails

  • Methodendetails

    • init

      public void init() throws InitializationException
      Initializes the SchedulerService.
      Angegeben von:
      init in Schnittstelle Initable
      Setzt außer Kraft:
      init in Klasse TurbineBaseService
      Löst aus:
      InitializationException - Something went wrong in the init stage
    • loadJobs

      protected abstract List<? extends JobEntry> loadJobs() throws TurbineException
      Load all jobs from configuration storage
      Gibt zurück:
      the list of pre-configured jobs
      Löst aus:
      TurbineException - if jobs could not be loaded
    • shutdown

      public void shutdown()
      Shutdowns the service. This methods interrupts the housekeeping thread.
      Angegeben von:
      shutdown in Schnittstelle Initable
      Setzt außer Kraft:
      shutdown in Klasse TurbineBaseService
    • newJob

      public abstract JobEntry newJob(int sec, int min, int hour, int wd, int day_mo, String task) throws TurbineException
      Beschreibung aus Schnittstelle kopiert: ScheduleService
      Factory method for a new Job Schedule a job to run on a certain point of time.
      Example 1: Run the DefaultScheduledJob at 8:00am every 15th of the month -
      JobEntry je = newJob(0,0,8,-1,15,"DefaultScheduledJob");
      Example 2: Run the DefaultScheduledJob at 8:00am every day -
      JobEntry je = newJob(0,0,8,-1,-1,"DefaultScheduledJob");
      Example 3: Run the DefaultScheduledJob every 2 hours. -
      JobEntry je = newJob(0,120,-1,-1,-1,"DefaultScheduledJob");
      Example 4: Run the DefaultScheduledJob every 30 seconds. -
      JobEntry je = newJob(30,-1,-1,-1,-1,"DefaultScheduledJob");
      Angegeben von:
      newJob in Schnittstelle ScheduleService
      Parameter:
      sec - Value for entry "seconds".
      min - Value for entry "minutes".
      hour - Value for entry "hours".
      wd - Value for entry "week days".
      day_mo - Value for entry "month days".
      task - Task to execute.
      Gibt zurück:
      A JobEntry.
      Löst aus:
      TurbineException - could not create job
      Siehe auch:
    • getJob

      public abstract JobEntry getJob(int oid) throws TurbineException
      Get a specific Job from Storage.
      Angegeben von:
      getJob in Schnittstelle ScheduleService
      Parameter:
      oid - The int id for the job.
      Gibt zurück:
      A JobEntry.
      Löst aus:
      TurbineException - job could not be retrieved.
    • addJob

      public void addJob(JobEntry je) throws TurbineException
      Add a new job to the queue.
      Angegeben von:
      addJob in Schnittstelle ScheduleService
      Parameter:
      je - A JobEntry with the job to add.
      Löst aus:
      TurbineException - job could not be added
    • removeJob

      public abstract void removeJob(JobEntry je) throws TurbineException
      Remove a job from the queue.
      Angegeben von:
      removeJob in Schnittstelle ScheduleService
      Parameter:
      je - A JobEntry with the job to remove.
      Löst aus:
      TurbineException - job could not be removed
    • updateJob

      public abstract void updateJob(JobEntry je) throws TurbineException
      Add or update a job.
      Angegeben von:
      updateJob in Schnittstelle ScheduleService
      Parameter:
      je - A JobEntry with the job to modify
      Löst aus:
      TurbineException - job could not be updated
    • listJobs

      public List<JobEntry> listJobs()
      List jobs in the queue. This is used by the scheduler UI.
      Angegeben von:
      listJobs in Schnittstelle ScheduleService
      Gibt zurück:
      A List of jobs.
    • setEnabled

      protected void setEnabled(boolean enabled)
      Sets the enabled status of the scheduler
      Parameter:
      enabled - true to enable the scheduler
    • isEnabled

      public boolean isEnabled()
      Determines if the scheduler service is currently enabled.
      Angegeben von:
      isEnabled in Schnittstelle ScheduleService
      Gibt zurück:
      Status of the scheduler service.
    • startScheduler

      public void startScheduler()
      Starts or restarts the scheduler if not already running.
      Angegeben von:
      startScheduler in Schnittstelle ScheduleService
    • stopScheduler

      public void stopScheduler()
      Stops the scheduler if it is currently running.
      Angegeben von:
      stopScheduler in Schnittstelle ScheduleService
    • getThread

      public Thread getThread()
      Return the thread being used to process commands, or null if there is no such thread. You can use this to invoke any special methods on the thread, for example, to interrupt it.
      Gibt zurück:
      A Thread.
    • clearThread

      protected void clearThread()
      Set thread to null to indicate termination.
    • restart

      public void restart()
      Start (or restart) a thread to process commands, or wake up an existing thread if one is already running. This method can be invoked if the background thread crashed due to an unrecoverable exception in an executed command.
    • nextJob

      protected JobEntry nextJob() throws TurbineException
      Return the next Job to execute, or null if thread is interrupted.
      Gibt zurück:
      A JobEntry.
      Löst aus:
      TurbineException - a generic exception.