Scheduled using ScheduledExecutorService
Because the job is implemented, java.util.concurrent.Callable
it can be scheduled based on ScheduledExecutorService
- Reference Code
Job job = ..;
ScheduledExecutorService scheduledExecutorService = Executors.newScheduledThreadPool(5);
ScheduledFuture scheduledFuture = scheduledExecutorService.schedule(job, 5, TimeUnit.SECONDS);
Use Quartz
It contains a easybatch-quartz
module, but the downside is that 6.0 is removed, but still can learn to use
we can EasyBatchJob && EasyBatchJobFactory easy integration Quartz
References
https://github.com/j-easy/easy-batch/wiki/job-scheduling
https://github.com/j-easy/easy-batch/blob/master/easy-batch-tutorials/src/main/java/org/jeasy/batch/tutorials/advanced/quartz/Launcher.java