Skip to content

ajlane/scheduler

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

42 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Scheduler

javadoc build-status codecov

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.

Examples

Using java.time

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()
);

Using Cron

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")
);

Getting Started

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>

About

A clock-based ExecutorService using Java 8 Time.

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages