Scheduler for Kotlin

Calendar-aware scheduling of recurring tasks, in explicit time zones, with clear policies for failures, overlaps and missed runs.

What's inside

Discover the capabilities built to elevate your Kotlin applications.

Five Kinds of Schedule

Interval schedules repeat at a fixed elapsed time from an anchor, independent of time zones and daylight saving. Daily, weekly, monthly and yearly schedules follow the calendar.

Every Other Week, or Month

Run every second week, every third month or at any other frequency, counted from a starting date.

Ordinal and Date Rules

Schedule the second Tuesday or the last Friday of a month, or the 15th or the last day, and dates a month doesn't have are simply skipped.

Time Zones and Daylight Saving

Every calendar schedule names its time zone. A time that falls in a daylight-saving gap moves forward by the gap, and one that falls in an overlap runs once.

Composite and Custom Schedules

Combine rules into a schedule that fires at the earliest of them, or implement your own, such as a business-day calendar.

Next-Occurrence Calculation

Find the next occurrence after any instant, or a lazy sequence of occurrences, with or without the task scheduler.

Task Scheduler

Run tasks in-process on your own executor or on daemon threads the scheduler manages. A task that fails is reported and stays scheduled without affecting any other, tasks can be added, removed or rescheduled while it runs, and closing it waits for runs in progress.

Overlap and Misfire Policies

Choose whether an occurrence that arrives while the last run is still going is skipped, queued or run alongside it, and whether missed occurrences are skipped, run once or all run in order.

Outcome Listeners

Listen for tasks starting, succeeding, failing or being skipped, with how long each run took. By default, outcomes are logged through the JDK's System.Logger.