Class QuartzSchedulingService

java.lang.Object
org.red5.server.scheduling.QuartzSchedulingService
All Implemented Interfaces:
ISchedulingService, IScopeService, QuartzSchedulingServiceMXBean, DisposableBean, InitializingBean
Direct Known Subclasses:
ApplicationSchedulingService

@ManagedResource(objectName="org.red5.server:name=schedulingService,type=QuartzSchedulingService") public class QuartzSchedulingService extends Object implements ISchedulingService, QuartzSchedulingServiceMXBean, InitializingBean, DisposableBean
Scheduling service that uses Quartz as backend.
Author:
The Red5 Project, Joachim Bauch (jojo@struktur.de), Paul Gregoire (mondain@gmail.com)
  • Field Details

    • log

      private static org.slf4j.Logger log
    • configFile

      protected String configFile
      Quartz configuration properties file
    • jobDetailCounter

      protected AtomicLong jobDetailCounter
      Number of job details
    • factory

      protected org.quartz.SchedulerFactory factory
      Creates schedulers.
    • jobDetailfactory

      protected JobDetailFactoryBean jobDetailfactory
      Creates job detail.
    • triggerfactory

      protected SimpleTriggerFactoryBean triggerfactory
      Creates triggers.
    • scheduler

      protected org.quartz.Scheduler scheduler
      Service scheduler
    • instanceId

      protected String instanceId
      Instance id
    • threadCount

      protected String threadCount
      Default thread count
    • keyMap

      Storage for job and trigger keys
  • Constructor Details

    • QuartzSchedulingService

      public QuartzSchedulingService()
  • Method Details

    • afterPropertiesSet

      public void afterPropertiesSet() throws Exception
      Constructs a new QuartzSchedulingService.
      Specified by:
      afterPropertiesSet in interface InitializingBean
      Throws:
      Exception
    • setFactory

      public void setFactory(org.quartz.SchedulerFactory factory)
    • setInstanceId

      public void setInstanceId(String instanceId)
    • getConfigFile

      public String getConfigFile()
    • setConfigFile

      public void setConfigFile(String configFile)
    • getThreadCount

      public String getThreadCount()
      Returns:
      the threadCount
    • setThreadCount

      public void setThreadCount(String threadCount)
      Parameters:
      threadCount - the threadCount to set
    • addScheduledJob

      public String addScheduledJob(int interval, IScheduledJob job)
      Schedule a job for periodic execution.
      Specified by:
      addScheduledJob in interface ISchedulingService
      Parameters:
      interval - time in milliseconds between two notifications of the job
      job - the job to trigger periodically
      Returns:
      the name of the scheduled job
    • addScheduledOnceJob

      public String addScheduledOnceJob(Date date, IScheduledJob job)
      Schedule a job for single execution at a given date. Please note that the jobs are not saved if Red5 is restarted in the meantime.
      Specified by:
      addScheduledOnceJob in interface ISchedulingService
      Parameters:
      date - date when the job should be executed
      job - the job to trigger
      Returns:
      the name of the scheduled job
    • addScheduledOnceJob

      public String addScheduledOnceJob(long timeDelta, IScheduledJob job)
      Schedule a job for single execution in the future. Please note that the jobs are not saved if Red5 is restarted in the meantime.
      Specified by:
      addScheduledOnceJob in interface ISchedulingService
      Parameters:
      timeDelta - time delta in milliseconds from the current date
      job - the job to trigger
      Returns:
      the name of the scheduled job
    • addScheduledJobAfterDelay

      public String addScheduledJobAfterDelay(int interval, IScheduledJob job, int delay)
      Schedule a job for periodic execution which will start after the specifed delay.
      Specified by:
      addScheduledJobAfterDelay in interface ISchedulingService
      Parameters:
      interval - time in milliseconds between two notifications of the job
      job - the job to trigger periodically
      delay - time in milliseconds to pass before first execution.
      Returns:
      the name of the scheduled job
    • getJobName

      public String getJobName()
      Getter for job name.
      Specified by:
      getJobName in interface QuartzSchedulingServiceMXBean
      Returns:
      Job name
    • getScheduledJobNames

      public List<String> getScheduledJobNames()
      Return names of scheduled jobs.
      Specified by:
      getScheduledJobNames in interface ISchedulingService
      Specified by:
      getScheduledJobNames in interface QuartzSchedulingServiceMXBean
      Returns:
      list of job names
    • pauseScheduledJob

      public void pauseScheduledJob(String name)
      Pauses the trigger which initiates job execution.
      Specified by:
      pauseScheduledJob in interface ISchedulingService
      Parameters:
      name - name of the job to stop
    • resumeScheduledJob

      public void resumeScheduledJob(String name)
      Resumes the trigger which initiates job execution.
      Specified by:
      resumeScheduledJob in interface ISchedulingService
      Parameters:
      name - name of the job to stop
    • pauseScheduledTrigger

      public void pauseScheduledTrigger(String name)
    • resumeScheduledTrigger

      public void resumeScheduledTrigger(String name)
    • removeScheduledJob

      public void removeScheduledJob(String name)
      Stop executing a previously scheduled job.
      Specified by:
      removeScheduledJob in interface ISchedulingService
      Specified by:
      removeScheduledJob in interface QuartzSchedulingServiceMXBean
      Parameters:
      name - name of the job to stop
    • scheduleJob

      private void scheduleJob(org.quartz.Trigger trigger, org.quartz.JobDetail jobDetail)
      Schedules job
      Parameters:
      trigger - Job trigger
      jobDetail - Job detail
    • destroy

      public void destroy() throws Exception
      Specified by:
      destroy in interface DisposableBean
      Throws:
      Exception