A clock-based ExecutorService using Java 8 Time. For when Quartz is just too heavy.
Scheduler is provided under the Apache License Version 2.0.
CalendarExecutorService executor = CalendarExecutorService.threadPool();
executor.schedule(
() -> System.out.println("Remember me."),
// Midnight (local time), 23 September 2017
ZonedDateTime.of(2017, 09, 23, 13, 0, 0, ZoneId.systemDefault()).toInstant()
);
CalendarExecutorService executor = CalendarExecutorService.threadPool();
CronParser parser = new CronParser(CronDefinitionBuilder.instanceDefinitionFor(CronType.QUARTZ));
executor.schedule(
() -> System.out.println("Ding dong."),
// Every hour, on the hour, Monday to Friday, 9am to 5pm
parser.parse("0 0 9-17 * * * 1-5")
);
Scheduler is available in Maven Central, using the following coordinates:
<project>
...
<dependencies>
<dependency>
<groupId>au.id.ajlane.scheduler</groupId>
<artifactId>scheduler</artifactId>
<version>0.0.3</version>
</dependency>
</dependencies>
...
</project>