Class DefaultSchedulerService
- java.lang.Object
-
- com.broadleafcommerce.scheduledjob.service.DefaultSchedulerService
-
- All Implemented Interfaces:
SchedulerService
public class DefaultSchedulerService extends Object implements SchedulerService
- Author:
- Chad Harchar (charchar)
-
-
Field Summary
Fields Modifier and Type Field Description static StringEVENT_PRODUCER_KEYprotected static StringJOB_DETAIL_JOB_KEYstatic StringJOB_REPOSITORY_KEYstatic StringJOB_SERVICE_KEYprotected static StringTYPE_FACTORY
-
Constructor Summary
Constructors Constructor Description 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)Initializes the scheduler service with anStdSchedulerDefaultSchedulerService(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
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected org.quartz.JobDetailcreateJobDetail(ScheduledJob job)protected Optional<org.quartz.Trigger>createTrigger(ScheduledJob job)protected voiddeleteJobIfExists(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 Class<? extends org.quartz.Job>getJobClass()The POJO that corresponds to the object that should execute when the quartz job is triggered.protected voidinitializeAndStartScheduler()Optional<org.quartz.JobDetail>processJob(ScheduledJob job)Review aScheduledJoband add scheduling and trigger information to the running quartz instance, if it's not already there.voidschedule(com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)Initiates the quartz scheduler to create, update, and delete quartz jobs according to theScheduled Jobsdefined in the database.protected booleanupdateDetected(ScheduledJob job, org.quartz.JobKey thisJobKey)
-
-
-
Field Detail
-
EVENT_PRODUCER_KEY
public static final String EVENT_PRODUCER_KEY
- See Also:
- Constant Field Values
-
JOB_SERVICE_KEY
public static final String JOB_SERVICE_KEY
- See Also:
- Constant Field Values
-
JOB_REPOSITORY_KEY
public static final String JOB_REPOSITORY_KEY
- See Also:
- Constant Field Values
-
JOB_DETAIL_JOB_KEY
protected static final String JOB_DETAIL_JOB_KEY
- See Also:
- Constant Field Values
-
TYPE_FACTORY
protected static final String TYPE_FACTORY
- See Also:
- Constant Field Values
-
-
Constructor Detail
-
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 Detail
-
schedule
public void schedule(@Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)Description copied from interface:SchedulerServiceInitiates the quartz scheduler to create, update, and delete quartz jobs according to theScheduled Jobsdefined in the database.- Specified by:
schedulein interfaceSchedulerService- Parameters:
contextInfo- context information surrounding multitenant state
-
processJob
public Optional<org.quartz.JobDetail> processJob(ScheduledJob job) throws org.quartz.SchedulerException
Description copied from interface:SchedulerServiceReview aScheduledJoband add scheduling and trigger information to the running quartz instance, if it's not already there.- Specified by:
processJobin interfaceSchedulerService- Parameters:
job- The scheduled job entity- Returns:
- The
JobDetailresulting 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
protected org.quartz.JobDetail createJobDetail(ScheduledJob job)
-
deleteJobIfExists
protected void deleteJobIfExists(ScheduledJob job, org.quartz.JobKey thisJobKey, Set<org.quartz.JobKey> jobKeys) throws org.quartz.SchedulerException
- Throws:
org.quartz.SchedulerException
-
createTrigger
protected Optional<org.quartz.Trigger> createTrigger(ScheduledJob job)
-
updateDetected
protected boolean updateDetected(ScheduledJob job, org.quartz.JobKey thisJobKey) throws org.quartz.SchedulerException
- Throws:
org.quartz.SchedulerException
-
getJobClass
protected Class<? extends org.quartz.Job> 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.
-
-