Class JobQueuer
java.lang.Object
io.github.qsy7.queue.impl.scheduling.JobQueuer
- All Implemented Interfaces:
StartupAware,AutoCloseable
Makes jobs persistent that are registered with @Job.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected final QueueServiceprotected final org.reflections.Reflections -
Constructor Summary
ConstructorsConstructorDescriptionJobQueuer(QueueService queueService, org.reflections.Reflections reflections) -
Method Summary
Modifier and TypeMethodDescriptionprotected voidaddJobs(Set<io.github.qsy7.queue.api.model.QueuedJob> queuedJobs, Set<io.github.qsy7.queue.api.model.ScheduleInstance> scheduleInstances, Class jobClass, boolean system) protected booleancancelJob(io.github.qsy7.queue.api.model.AbstractQueued queuedJob) protected voidCancel old Jobs (QueuedJob) versus (QueuedEvent), events are generated by the application and cannot be rescheduled However, QueuedJobs are "permanent" and can be rescheduled when the application is restarted.voidclose()protected Set<io.github.qsy7.queue.api.model.QueuedJob> protected Set<io.github.qsy7.queue.api.model.ScheduleInstance> getScheduleInstances(Job jobAnnotation) protected voidscheduleJob(io.github.qsy7.queue.api.model.QueuedJob queuedJob) protected voidvoidstartup()Any jobs that were in-flight at time of shutdown will be marked as cancelled and discovered jobs will be recreated.
-
Field Details
-
queueService
-
reflections
protected final org.reflections.Reflections reflections
-
-
Constructor Details
-
JobQueuer
-
-
Method Details
-
startup
public void startup()Any jobs that were in-flight at time of shutdown will be marked as cancelled and discovered jobs will be recreated.- Specified by:
startupin interfaceStartupAware
-
close
public void close()- Specified by:
closein interfaceAutoCloseable
-
cancelOldJobs
protected void cancelOldJobs()Cancel old Jobs (QueuedJob) versus (QueuedEvent), events are generated by the application and cannot be rescheduled However, QueuedJobs are "permanent" and can be rescheduled when the application is restarted. In order to handle job schedule changes, mark all the incomplete ones as aborted, then reschedule anything found. -
cancelJob
protected boolean cancelJob(io.github.qsy7.queue.api.model.AbstractQueued queuedJob) -
scheduleJobs
protected void scheduleJobs() -
scheduleJob
protected void scheduleJob(io.github.qsy7.queue.api.model.QueuedJob queuedJob) -
getQueuedJobs
-
getScheduleInstances
-
addJobs
-