Package org.red5.server.scheduling
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 ([email protected]), Paul Gregoire ([email protected])
-
Nested Class Summary
Nested Classes -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected StringQuartz configuration properties fileprotected org.quartz.SchedulerFactoryCreates schedulers.protected StringInstance idprotected AtomicLongNumber of job detailsprotected JobDetailFactoryBeanCreates job detail.Storage for job and trigger keysprivate static org.slf4j.Loggerprotected org.quartz.SchedulerService schedulerprotected StringDefault thread countprotected SimpleTriggerFactoryBeanCreates triggers.Fields inherited from interface org.red5.server.api.scheduling.ISchedulingService
BEAN_NAME -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionaddScheduledJob(int interval, IScheduledJob job) Schedule a job for periodic execution.addScheduledJobAfterDelay(int interval, IScheduledJob job, int delay) Schedule a job for periodic execution which will start after the specifed delay.addScheduledOnceJob(long timeDelta, IScheduledJob job) Schedule a job for single execution in the future.addScheduledOnceJob(Date date, IScheduledJob job) Schedule a job for single execution at a given date.voidConstructs a new QuartzSchedulingService.voiddestroy()Getter for job name.Return names of scheduled jobs.voidpauseScheduledJob(String name) Pauses the trigger which initiates job execution.voidpauseScheduledTrigger(String name) voidremoveScheduledJob(String name) Stop executing a previously scheduled job.voidresumeScheduledJob(String name) Resumes the trigger which initiates job execution.voidresumeScheduledTrigger(String name) private voidscheduleJob(org.quartz.Trigger trigger, org.quartz.JobDetail jobDetail) Schedules jobvoidsetConfigFile(String configFile) voidsetFactory(org.quartz.SchedulerFactory factory) voidsetInstanceId(String instanceId) voidsetThreadCount(String threadCount)
-
Field Details
-
log
private static org.slf4j.Logger log -
configFile
Quartz configuration properties file -
jobDetailCounter
Number of job details -
factory
protected org.quartz.SchedulerFactory factoryCreates schedulers. -
jobDetailfactory
Creates job detail. -
triggerfactory
Creates triggers. -
scheduler
protected org.quartz.Scheduler schedulerService scheduler -
instanceId
Instance id -
threadCount
Default thread count -
keyMap
Storage for job and trigger keys
-
-
Constructor Details
-
QuartzSchedulingService
public QuartzSchedulingService()
-
-
Method Details
-
afterPropertiesSet
Constructs a new QuartzSchedulingService.- Specified by:
afterPropertiesSetin interfaceInitializingBean- Throws:
Exception
-
setFactory
public void setFactory(org.quartz.SchedulerFactory factory) -
setInstanceId
-
getConfigFile
-
setConfigFile
-
getThreadCount
- Returns:
- the threadCount
-
setThreadCount
- Parameters:
threadCount- the threadCount to set
-
addScheduledJob
Schedule a job for periodic execution.- Specified by:
addScheduledJobin interfaceISchedulingService- Parameters:
interval- time in milliseconds between two notifications of the jobjob- the job to trigger periodically- Returns:
- the name of the scheduled job
-
addScheduledOnceJob
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:
addScheduledOnceJobin interfaceISchedulingService- Parameters:
date- date when the job should be executedjob- the job to trigger- Returns:
- the name of the scheduled job
-
addScheduledOnceJob
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:
addScheduledOnceJobin interfaceISchedulingService- Parameters:
timeDelta- time delta in milliseconds from the current datejob- the job to trigger- Returns:
- the name of the scheduled job
-
addScheduledJobAfterDelay
Schedule a job for periodic execution which will start after the specifed delay.- Specified by:
addScheduledJobAfterDelayin interfaceISchedulingService- Parameters:
interval- time in milliseconds between two notifications of the jobjob- the job to trigger periodicallydelay- time in milliseconds to pass before first execution.- Returns:
- the name of the scheduled job
-
getJobName
Getter for job name.- Specified by:
getJobNamein interfaceQuartzSchedulingServiceMXBean- Returns:
- Job name
-
getScheduledJobNames
Return names of scheduled jobs.- Specified by:
getScheduledJobNamesin interfaceISchedulingService- Specified by:
getScheduledJobNamesin interfaceQuartzSchedulingServiceMXBean- Returns:
- list of job names
-
pauseScheduledJob
Pauses the trigger which initiates job execution.- Specified by:
pauseScheduledJobin interfaceISchedulingService- Parameters:
name- name of the job to stop
-
resumeScheduledJob
Resumes the trigger which initiates job execution.- Specified by:
resumeScheduledJobin interfaceISchedulingService- Parameters:
name- name of the job to stop
-
pauseScheduledTrigger
-
resumeScheduledTrigger
-
removeScheduledJob
Stop executing a previously scheduled job.- Specified by:
removeScheduledJobin interfaceISchedulingService- Specified by:
removeScheduledJobin interfaceQuartzSchedulingServiceMXBean- 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 triggerjobDetail- Job detail
-
destroy
- Specified by:
destroyin interfaceDisposableBean- Throws:
Exception
-