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
Schedule service implementation. Since the cleanup of the quartz job is done when service is activated, ( 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
FieldsModifier and TypeFieldDescriptionstatic final DurationDefault value is set to 5 seconds to delay the start by defaultstatic final Stringstatic final Durationstatic final Stringprotected RuntimeContextprotected final ScheduleExtensionRegistryprotected org.quartz.SchedulerFields inherited from class org.nuxeo.runtime.model.DefaultComponent
lastModified, name -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidactivate(ComponentContext context) Activates the component.voiddeactivate(ComponentContext context) Deactivates the component.Gets the list of the registered schedules.booleanChecks 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 voidprotected voidschedule(Schedule schedule, Map<String, Serializable> parameters) protected voidprotected voidvoidstart(ComponentContext context) Start the component.protected voidvoidstop(ComponentContext context) Stop the component.voidunregisterExtension(Extension extension) Unregisters the given extension.booleanUnRegisters 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, unregisterContributionMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.nuxeo.runtime.model.Component
getApplicationStartedOrder
-
Field Details
-
CLUSTER_START_DURATION_PROP
- Since:
- 11.1
- See Also:
-
CLUSTER_START_DURATION_DEFAULT
- Since:
- 11.1
-
CLUSTER_START_DELAY_PROP
- Since:
- 2021.19
- See Also:
-
CLUSTER_START_DELAY_DEFAULT
Default value is set to 5 seconds to delay the start by default- Since:
- 2021.19
-
context
-
scheduler
protected org.quartz.Scheduler scheduler -
registry
-
-
Constructor Details
-
SchedulerServiceImpl
public SchedulerServiceImpl()
-
-
Method Details
-
activate
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
- Throws:
IOExceptionorg.quartz.SchedulerException
-
shutdownScheduler
protected void shutdownScheduler() -
deactivate
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
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
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
Description copied from interface:ExtensibleRegisters the given extension.- Specified by:
registerExtensionin interfaceExtensible- Overrides:
registerExtensionin classDefaultComponent- Parameters:
extension- the extension to register
-
unregisterExtension
Description copied from interface:ExtensibleUnregisters the given extension.- Specified by:
unregisterExtensionin interfaceExtensible- Overrides:
unregisterExtensionin classDefaultComponent- Parameters:
extension- the extension to unregister
-
getContext
-
registerSchedule
Description copied from interface:SchedulerServiceRegisters a schedule.- Specified by:
registerSchedulein interfaceSchedulerService- Parameters:
schedule- the schedule
-
registerSchedule
Description copied from interface:SchedulerServiceRegisters a schedule. Add all parameters to eventContext.- Specified by:
registerSchedulein interfaceSchedulerService
-
schedule
-
unregisterSchedule
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
-
unschedule
-
unregisterSchedule
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
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
-