Package dev.relism.flash.ext.scheduler
Class Cron
java.lang.Object
dev.relism.flash.ext.scheduler.Cron
A cron expression compiled to bitmasks.
Accepts five fields (min hour dom mon dow) or six with a leading seconds field.
Each is parsed once into a bitmask — a long for seconds and minutes, an int for
the rest — so matching a candidate instant is a shift and a mask rather than a parse, a list
walk or a set lookup.
Cron.parse("0 0 3 * * *") // 03:00:00 every day Cron.parse("*/15 * * * *") // every 15 minutes Cron.parse("0 9 * * MON-FRI") // 09:00 on weekdays
-
Method Summary
Modifier and TypeMethodDescriptionnextAfter(ZonedDateTime from) The first instant strictly afterfromthat matches.static CrontoString()
-
Method Details
-
parse
- Throws:
IllegalArgumentException- if the expression is malformed — at boot, not at fire time
-
nextAfter
The first instant strictly afterfromthat matches.Advances by the largest unit that cannot match rather than ticking second by second, so a yearly expression resolves in a few dozen iterations instead of thirty million.
-
toString
-