-
Notifications
You must be signed in to change notification settings - Fork 198
job scheduling
Easy Batch jobs implement the java.util.concurrent.Callable interface so they can be easily scheduled using a java.util.concurrent.ScheduledExecutorService:
Job job = ..;
ScheduledExecutorService scheduledExecutorService = Executors.newScheduledThreadPool(5);
ScheduledFuture scheduledFuture = scheduledExecutorService.schedule(job, 5, TimeUnit.SECONDS);In this example, the job will be scheduled to run in 5 seconds.
The advantage of java.util.concurrent.ScheduledExecutorService is that it allows you to schedule jobs without requiring any third party library. But this service is limited in terms of scheduling features. For example, it does not support cron expressions.
That's why Easy Batch provides an extension to schedule jobs with the popular Java scheduler Quartz.
The JobScheduler API provided in the easybatch-quartz module allows you to schedule job execution:
- At a fixed point of time using
scheduleAt(Job job, Date when) - Repeatedly with predefined interval using
scheduleAtWithInterval(Job job, Date when, int interval) - Using unix cron-like expression with
scheduleCron(Job job, String cronExpression)
Easy Batch is created by Mahmoud Ben Hassine with the help of some awesome contributors
-
Introduction
-
User guide
-
Job reference
-
Component reference
-
Get involved