Class QuartzSchedulerService

    • Field Detail

      • log

        protected static final org.apache.logging.log4j.Logger log
        Logging
      • enabled

        protected boolean enabled
        Current status of the scheduler
    • Method Detail

      • newJob

        public JobEntry newJob​(int sec,
                               int min,
                               int hour,
                               int wd,
                               int day_mo,
                               String task)
                        throws TurbineException
        Description copied from interface: 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");
        Specified by:
        newJob in interface ScheduleService
        Parameters:
        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.
        Returns:
        A JobEntry.
        Throws:
        TurbineException - could not create job
        See Also:
        ScheduleService.newJob(int, int, int, int, int, java.lang.String)
      • setEnabled

        protected void setEnabled​(boolean enabled)
        Sets the enabled status of the scheduler
        Parameters:
        enabled - true if enabled
      • isEnabled

        public boolean isEnabled()
        Determines if the scheduler service is currently enabled.
        Specified by:
        isEnabled in interface ScheduleService
        Returns:
        Status of the scheduler service.
      • 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.
      • getScheduler

        public org.quartz.Scheduler getScheduler()
        Exposing the Quartz scheduler to handle jobs/triggers in more detail.
        Returns:
        the Scheduler of this service.
      • buildJobEntry

        public JobEntryQuartz buildJobEntry​(org.quartz.Trigger trigger,
                                            org.quartz.JobDetail jd)
        Builds a JobEntryQuartz from Quartz trigger/job. The developer should be aware to set identity/context properly, i.e. to JobEntryQuartz.DEFAULT_JOB_GROUP_NAME, if adding triggers/jobs.
        Parameters:
        trigger - a Quartz Trigger.
        jd - a Quartz JobDetail (built from a Job with JobBuilder).
        Returns:
        A JobEntryQuartz.