org.red5.server.scheduling

## Class QuartzSchedulingService

- java.lang.Object
- - org.red5.server.scheduling.QuartzSchedulingService

All Implemented Interfaces:
  ISchedulingService, IScopeService, QuartzSchedulingServiceMXBean, org.springframework.beans.factory.DisposableBean, org.springframework.beans.factory.InitializingBean

Direct Known Subclasses:
  ApplicationSchedulingService

    @ManagedResource(objectName="org.red5.server:name=schedulingService,type=QuartzSchedulingService")
    public class QuartzSchedulingService
    extends Object
    implements ISchedulingService, QuartzSchedulingServiceMXBean, org.springframework.beans.factory.InitializingBean, org.springframework.beans.factory.DisposableBean

Scheduling service that uses Quartz as backend.

Author:
  The Red5 Project (red5@osflash.org), Joachim Bauch (jojo@struktur.de), Paul Gregoire (mondain@gmail.com)

### Field Summary

Fields
`protected org.quartz.SchedulerFactory` `factory` Creates schedulers.
`protected String` `instanceId` Instance id
`protected AtomicLong` `jobDetailCounter` Number of job details
`protected org.quartz.Scheduler` `scheduler` Service scheduler

### Fields inherited from interface org.red5.server.api.scheduling.ISchedulingService

`BEAN_NAME`

### Constructor Summary

Constructors
Constructor and Description
`QuartzSchedulingService()`

### Method Summary

Methods
`String` `addScheduledJob(int interval, IScheduledJob job)` Schedule a job for periodic execution.
`String` `addScheduledJobAfterDelay(int interval, IScheduledJob job, int delay)` Schedule a job for periodic execution which will start after the specifed delay.
`String` `addScheduledOnceJob(Date date, IScheduledJob job)` Schedule a job for single execution at a given date.
`String` `addScheduledOnceJob(long timeDelta, IScheduledJob job)` Schedule a job for single execution in the future.
`void` `afterPropertiesSet()` Constructs a new QuartzSchedulingService.
`void` `destroy()`
`String` `getJobName()` Getter for job name.
`List<String>` `getScheduledJobNames()` Return names of scheduled jobs.
`void` `pauseScheduledJob(String name)` Pauses the trigger which initiates job execution.
`void` `pauseScheduledTrigger(String name)`
`void` `removeScheduledJob(String name)` Stop executing a previously scheduled job.
`void` `resumeScheduledJob(String name)` Resumes the trigger which initiates job execution.
`void` `resumeScheduledTrigger(String name)`
`void` `setFactory(org.quartz.SchedulerFactory factory)`
`void` `setInstanceId(String instanceId)`

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

### Field Detail

#### jobDetailCounter

    protected AtomicLong jobDetailCounter

Number of job details

#### factory

    protected org.quartz.SchedulerFactory factory

Creates schedulers.

#### scheduler

    protected org.quartz.Scheduler scheduler

Service scheduler

#### instanceId

    protected String instanceId

Instance id

### Constructor Detail

#### QuartzSchedulingService

    public QuartzSchedulingService()

### Method Detail

#### afterPropertiesSet

    public void afterPropertiesSet()
                            throws Exception

Constructs a new QuartzSchedulingService.

Specified by:
  `afterPropertiesSet` in interface `org.springframework.beans.factory.InitializingBean`
Throws:
  `Exception`

#### setFactory

    public void setFactory(org.quartz.SchedulerFactory factory)

#### setInstanceId

    public void setInstanceId(String instanceId)

#### 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

#### destroy

    public void destroy()
                 throws Exception

Specified by:
  `destroy` in interface `org.springframework.beans.factory.DisposableBean`
Throws:
  `Exception`