Package org.nuxeo.ecm.core.scheduler
Class SchedulerServiceImpl
- java.lang.Object
 - 
- org.nuxeo.runtime.model.DefaultComponent
 - 
- org.nuxeo.ecm.core.scheduler.SchedulerServiceImpl
 
 
 
- 
- All Implemented Interfaces:
 SchedulerService,Adaptable,Component,Extensible,TimestampedService
public class SchedulerServiceImpl extends DefaultComponent implements SchedulerService
Schedule service implementation. Since the cleanup of the quartz job is done when service is activated, ( see see https://jira.nuxeo.com/browse/NXP-7303 ) in cluster mode, the schedules contributions MUST be the same on all nodes. Due the fact that all jobs are removed when service starts on a node it may be a short period with no schedules in quartz table even other node is running. 
- 
- 
Field Summary
Fields Modifier and Type Field Description static DurationCLUSTER_START_DELAY_DEFAULTDefault value is set to 5 seconds to delay the start by defaultstatic StringCLUSTER_START_DELAY_PROPstatic DurationCLUSTER_START_DURATION_DEFAULTstatic StringCLUSTER_START_DURATION_PROPprotected RuntimeContextcontextprotected ScheduleExtensionRegistryregistryprotected org.quartz.Schedulerscheduler- 
Fields inherited from class org.nuxeo.runtime.model.DefaultComponent
lastModified, name 
 - 
 
- 
Constructor Summary
Constructors Constructor Description SchedulerServiceImpl() 
- 
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidactivate(ComponentContext context)Activates the component.voiddeactivate(ComponentContext context)Deactivates the component.RuntimeContextgetContext()List<Schedule>getSchedules()Gets the list of the registered schedules.booleanhasApplicationStarted()Checks if the framework has fully started.voidpause()Pause the scheduler service.voidregisterExtension(Extension extension)Registers the given extension.voidregisterSchedule(Schedule schedule)Registers a schedule.voidregisterSchedule(Schedule schedule, Map<String,Serializable> parameters)Registers a schedule.voidresume()Resume the scheduler service.protected voidschedule(String id, org.quartz.JobDetail job, org.quartz.Trigger trigger)protected voidschedule(Schedule schedule, Map<String,Serializable> parameters)protected voidsetupScheduler()protected voidshutdownScheduler()voidstart(ComponentContext context)Start the component.protected voidstartScheduler()voidstop(ComponentContext context)Stop the component.voidunregisterExtension(Extension extension)Unregisters the given extension.booleanunregisterSchedule(String id)UnRegisters a schedule.booleanunregisterSchedule(Schedule schedule)UnRegisters a schedule.protected booleanunschedule(String id)protected booleanunschedule(String id, org.quartz.JobKey jobKey)- 
Methods inherited from class org.nuxeo.runtime.model.DefaultComponent
addRuntimeMessage, addRuntimeMessage, getAdapter, getDescriptor, getDescriptors, getLastModified, getRegistry, register, registerContribution, setLastModified, setModifiedNow, setName, unregister, unregisterContribution 
- 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait 
- 
Methods inherited from interface org.nuxeo.runtime.model.Component
applicationStarted, getApplicationStartedOrder 
 - 
 
 - 
 
- 
- 
Field Detail
- 
CLUSTER_START_DURATION_PROP
public static final String CLUSTER_START_DURATION_PROP
- Since:
 - 11.1
 - See Also:
 - Constant Field Values
 
 
- 
CLUSTER_START_DURATION_DEFAULT
public static final Duration CLUSTER_START_DURATION_DEFAULT
- Since:
 - 11.1
 
 
- 
CLUSTER_START_DELAY_PROP
public static final String CLUSTER_START_DELAY_PROP
- Since:
 - 2021.19
 - See Also:
 - Constant Field Values
 
 
- 
CLUSTER_START_DELAY_DEFAULT
public static final Duration CLUSTER_START_DELAY_DEFAULT
Default value is set to 5 seconds to delay the start by default- Since:
 - 2021.19
 
 
- 
context
protected RuntimeContext context
 
- 
scheduler
protected org.quartz.Scheduler scheduler
 
- 
registry
protected final ScheduleExtensionRegistry registry
 
 - 
 
- 
Method Detail
- 
activate
public void activate(ComponentContext context)
Description copied from interface:ComponentActivates the component.This method is called by the runtime when a component is activated.
- Specified by:
 activatein interfaceComponent- Overrides:
 activatein classDefaultComponent- Parameters:
 context- the runtime context
 
- 
setupScheduler
protected void setupScheduler() throws IOException, org.quartz.SchedulerException- Throws:
 IOExceptionorg.quartz.SchedulerException
 
- 
shutdownScheduler
protected void shutdownScheduler()
 
- 
deactivate
public void deactivate(ComponentContext context)
Description copied from interface:ComponentDeactivates the component.This method is called by the runtime when a component is deactivated.
- Specified by:
 deactivatein interfaceComponent- Overrides:
 deactivatein classDefaultComponent- Parameters:
 context- the runtime context
 
- 
start
public void start(ComponentContext context)
Description copied from interface:ComponentStart the component. This method is called after all the components were resolved and activated- Specified by:
 startin interfaceComponent- Overrides:
 startin classDefaultComponent
 
- 
startScheduler
protected void startScheduler()
 
- 
stop
public void stop(ComponentContext context)
Description copied from interface:ComponentStop the component.- Specified by:
 stopin interfaceComponent- Overrides:
 stopin classDefaultComponent
 
- 
hasApplicationStarted
public boolean hasApplicationStarted()
Description copied from interface:SchedulerServiceChecks if the framework has fully started.Used to delay job execution until the framework has fully started.
- Specified by:
 hasApplicationStartedin interfaceSchedulerService- Returns:
 trueif the framework has started
 
- 
registerExtension
public void registerExtension(Extension extension)
Description copied from interface:ExtensibleRegisters the given extension.- Specified by:
 registerExtensionin interfaceExtensible- Overrides:
 registerExtensionin classDefaultComponent- Parameters:
 extension- the extension to register
 
- 
unregisterExtension
public void unregisterExtension(Extension extension)
Description copied from interface:ExtensibleUnregisters the given extension.- Specified by:
 unregisterExtensionin interfaceExtensible- Overrides:
 unregisterExtensionin classDefaultComponent- Parameters:
 extension- the extension to unregister
 
- 
getContext
public RuntimeContext getContext()
 
- 
registerSchedule
public void registerSchedule(Schedule schedule)
Description copied from interface:SchedulerServiceRegisters a schedule.- Specified by:
 registerSchedulein interfaceSchedulerService- Parameters:
 schedule- the schedule
 
- 
registerSchedule
public void registerSchedule(Schedule schedule, Map<String,Serializable> parameters)
Description copied from interface:SchedulerServiceRegisters a schedule. Add all parameters to eventContext.- Specified by:
 registerSchedulein interfaceSchedulerService
 
- 
schedule
protected void schedule(Schedule schedule, Map<String,Serializable> parameters)
 
- 
unregisterSchedule
public boolean unregisterSchedule(String id)
Description copied from interface:SchedulerServiceUnRegisters a schedule.- Specified by:
 unregisterSchedulein interfaceSchedulerService- Parameters:
 id- the schedule id- Returns:
 - true if schedule has been successfully removed.
 
 
- 
schedule
protected void schedule(String id, org.quartz.JobDetail job, org.quartz.Trigger trigger) throws org.quartz.SchedulerException
- Throws:
 org.quartz.SchedulerException
 
- 
unschedule
protected boolean unschedule(String id)
 
- 
unschedule
protected boolean unschedule(String id, org.quartz.JobKey jobKey)
 
- 
unregisterSchedule
public boolean unregisterSchedule(Schedule schedule)
Description copied from interface:SchedulerServiceUnRegisters a schedule.- Specified by:
 unregisterSchedulein interfaceSchedulerService- Parameters:
 schedule- to be unregistered- Returns:
 - true if schedule has been successfully removed.
 
 
- 
getSchedules
public List<Schedule> getSchedules()
Description copied from interface:SchedulerServiceGets the list of the registered schedules.- Specified by:
 getSchedulesin interfaceSchedulerService- Returns:
 - the schedules list
 
 
- 
pause
public void pause()
Description copied from interface:SchedulerServicePause the scheduler service. The pause is cluster-wide and survives a node restart. SeeSchedulerService.resume()to resume the schedules service.- Specified by:
 pausein interfaceSchedulerService
 
- 
resume
public void resume()
Description copied from interface:SchedulerServiceResume the scheduler service.- Specified by:
 resumein interfaceSchedulerService
 
 - 
 
 -