Class DefaultSchedulerService
java.lang.Object
com.broadleafcommerce.scheduledjob.service.DefaultSchedulerService
- All Implemented Interfaces:
SchedulerService
- Author:
- Chad Harchar (charchar)
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionDefaultSchedulerService
(ScheduledJobService<? extends ScheduledJob> jobService, ScheduledJobRepository<com.broadleafcommerce.data.tracking.core.Trackable> jobRepository, com.broadleafcommerce.common.messaging.notification.NotificationManager notificationManager, com.broadleafcommerce.common.extension.TypeFactory typeFactory, ClusterProperties clusterProperties) Initializes the scheduler service with anStdScheduler
DefaultSchedulerService
(ScheduledJobService<? extends ScheduledJob> jobService, ScheduledJobRepository<com.broadleafcommerce.data.tracking.core.Trackable> jobRepository, com.broadleafcommerce.common.messaging.notification.NotificationManager notificationManager, com.broadleafcommerce.common.extension.TypeFactory typeFactory, org.quartz.Scheduler scheduler, ClusterProperties clusterProperties) -
Method Summary
Modifier and TypeMethodDescriptionprotected org.quartz.JobDetail
protected Optional<org.quartz.Trigger>
protected void
deleteJobIfExists
(ScheduledJob job, org.quartz.JobKey thisJobKey, Set<org.quartz.JobKey> jobKeys) protected Optional<org.quartz.JobDetail>
establishTrigger
(ScheduledJob job, org.quartz.JobKey thisJobKey, boolean isUpdate) protected ClusterProperties
protected Class<? extends org.quartz.Job>
The POJO that corresponds to the object that should execute when the quartz job is triggered.protected ScheduledJobRepository<com.broadleafcommerce.data.tracking.core.Trackable>
protected ScheduledJobService<? extends ScheduledJob>
protected com.broadleafcommerce.common.messaging.notification.NotificationManager
protected org.quartz.Scheduler
protected com.broadleafcommerce.common.extension.TypeFactory
protected void
Optional<org.quartz.JobDetail>
processJob
(ScheduledJob job) Review aScheduledJob
and add scheduling and trigger information to the running quartz instance, if it's not already there.void
schedule
(com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Initiates the quartz scheduler to create, update, and delete quartz jobs according to theScheduled Jobs
defined in the database.void
unschedule
(@NonNull ScheduledJob job, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) protected boolean
updateDetected
(ScheduledJob job, org.quartz.JobKey thisJobKey)
-
Field Details
-
EVENT_PRODUCER_KEY
- See Also:
-
JOB_SERVICE_KEY
- See Also:
-
JOB_REPOSITORY_KEY
- See Also:
-
JOB_DETAIL_JOB_KEY
- See Also:
-
TYPE_FACTORY
- See Also:
-
-
Constructor Details
-
DefaultSchedulerService
public DefaultSchedulerService(ScheduledJobService<? extends ScheduledJob> jobService, ScheduledJobRepository<com.broadleafcommerce.data.tracking.core.Trackable> jobRepository, com.broadleafcommerce.common.messaging.notification.NotificationManager notificationManager, com.broadleafcommerce.common.extension.TypeFactory typeFactory, ClusterProperties clusterProperties) throws org.quartz.SchedulerException Initializes the scheduler service with anStdScheduler
- Throws:
org.quartz.SchedulerException
-
DefaultSchedulerService
public DefaultSchedulerService(ScheduledJobService<? extends ScheduledJob> jobService, ScheduledJobRepository<com.broadleafcommerce.data.tracking.core.Trackable> jobRepository, com.broadleafcommerce.common.messaging.notification.NotificationManager notificationManager, com.broadleafcommerce.common.extension.TypeFactory typeFactory, org.quartz.Scheduler scheduler, ClusterProperties clusterProperties) throws org.quartz.SchedulerException - Throws:
org.quartz.SchedulerException
-
-
Method Details
-
schedule
public void schedule(@Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Description copied from interface:SchedulerService
Initiates the quartz scheduler to create, update, and delete quartz jobs according to theScheduled Jobs
defined in the database.- Specified by:
schedule
in interfaceSchedulerService
- Parameters:
contextInfo
- context information surrounding multitenant state
-
unschedule
public void unschedule(@NonNull @NonNull ScheduledJob job, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) throws org.quartz.SchedulerException Description copied from interface:SchedulerService
- Specified by:
unschedule
in interfaceSchedulerService
- Parameters:
job
- The scheduled job entitycontextInfo
- context information surrounding multitenant state- Throws:
org.quartz.SchedulerException
- Thrown if a problem occurs in Quartz during scheduling
-
processJob
public Optional<org.quartz.JobDetail> processJob(ScheduledJob job) throws org.quartz.SchedulerException Description copied from interface:SchedulerService
Review aScheduledJob
and add scheduling and trigger information to the running quartz instance, if it's not already there.- Specified by:
processJob
in interfaceSchedulerService
- Parameters:
job
- The scheduled job entity- Returns:
- The
JobDetail
resulting from Quartz scheduling, if the item was scheduled - Throws:
org.quartz.SchedulerException
- Thrown if a problem occurs in Quartz during scheduling
-
initializeAndStartScheduler
protected void initializeAndStartScheduler() throws org.quartz.SchedulerException- Throws:
org.quartz.SchedulerException
-
establishTrigger
protected Optional<org.quartz.JobDetail> establishTrigger(ScheduledJob job, org.quartz.JobKey thisJobKey, boolean isUpdate) throws org.quartz.SchedulerException - Throws:
org.quartz.SchedulerException
-
createJobDetail
-
deleteJobIfExists
protected void deleteJobIfExists(ScheduledJob job, org.quartz.JobKey thisJobKey, Set<org.quartz.JobKey> jobKeys) throws org.quartz.SchedulerException - Throws:
org.quartz.SchedulerException
-
createTrigger
-
updateDetected
protected boolean updateDetected(ScheduledJob job, org.quartz.JobKey thisJobKey) throws org.quartz.SchedulerException - Throws:
org.quartz.SchedulerException
-
getJobClass
The POJO that corresponds to the object that should execute when the quartz job is triggered.- Returns:
- The POJO that corresponds to the object that should execute when the quartz job is triggered.
-
getJobService
-
getJobRepository
protected ScheduledJobRepository<com.broadleafcommerce.data.tracking.core.Trackable> getJobRepository() -
getNotificationManager
protected com.broadleafcommerce.common.messaging.notification.NotificationManager getNotificationManager() -
getTypeFactory
protected com.broadleafcommerce.common.extension.TypeFactory getTypeFactory() -
getClusterProperties
-
getScheduler
protected org.quartz.Scheduler getScheduler()
-