Class JDKSchedulingService

java.lang.Object
org.red5.server.scheduling.JDKSchedulingService
All Implemented Interfaces:
ISchedulingService, IScopeService, JDKSchedulingServiceMXBean, org.springframework.beans.factory.DisposableBean, org.springframework.beans.factory.InitializingBean

@ManagedResource(objectName="org.red5.server:name=schedulingService,type=JDKSchedulingService") public class JDKSchedulingService extends Object implements ISchedulingService, JDKSchedulingServiceMXBean, org.springframework.beans.factory.InitializingBean, org.springframework.beans.factory.DisposableBean
Scheduling service that uses JDK ScheduledExecutor as backend.
Author:
The Red5 Project, Paul Gregoire (mondain@gmail.com)
  • Field Details

  • Constructor Details

    • JDKSchedulingService

      public JDKSchedulingService()
  • Method Details

    • afterPropertiesSet

      public void afterPropertiesSet() throws Exception
      Constructs a new JDKSchedulingService.
      Specified by:
      afterPropertiesSet in interface org.springframework.beans.factory.InitializingBean
      Throws:
      Exception
    • getThreadCount

      public int getThreadCount()
      Returns:
      the threadCount
    • setThreadCount

      public void setThreadCount(int 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 specified 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 JDKSchedulingServiceMXBean
      Returns:
      Job name
    • getScheduledJobNames

      public List<String> getScheduledJobNames()
      Return names of scheduled jobs.
      Specified by:
      getScheduledJobNames in interface ISchedulingService
      Specified by:
      getScheduledJobNames in interface JDKSchedulingServiceMXBean
      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
    • removeScheduledJob

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

      public void destroy() throws Exception
      Specified by:
      destroy in interface org.springframework.beans.factory.DisposableBean
      Throws:
      Exception
    • isInterruptOnRemove

      public boolean isInterruptOnRemove()
    • setInterruptOnRemove

      public void setInterruptOnRemove(boolean interruptOnRemove)