DriversRecommendedOutdated drivers can make a good PC feel brokenScan driver issues before chasing fixes manually.Scan NowOctober DealsAmazon USOctober deal check: compare before you payAmazon US: current deals, useful picks and tech finds.Check DealsPC HealthRecommendedCrashes, freezes, slowdowns? Check your PC nowSpot repairable issues before they interrupt work.Check PC×
Skip to content
World desk5 min

How db-scheduler Keeps Java Jobs Persistent Across Restarts and Instances

db-scheduler persists scheduled Java task executions in a relational database and coordinates pickup across instances, but polling and schedule semantics do not guarantee every run occurs.
Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

db-scheduler stores scheduled task executions in a relational database so Java applications can resume work after a restart and coordinate task pickup across multiple application instances. It is a good fit when database-backed persistence and straightforward clustered scheduling matter more than exact-time execution or guaranteed catch-up: the scheduler polls for due work, and the project explicitly says that not every instant in a recurring schedule is guaranteed to run.

What db-scheduler does

db-scheduler is an embeddable Java task scheduler inspired by the need for a clustered version of ScheduledExecutorService. Its documented model uses a relational database table, typically named scheduled_tasks, to track future executions. Scheduler instances check the table for due work, claim an execution, run its task handler, and use the task’s schedule or handler to determine what happens next. The project describes its approach as simpler to operate than Quartz, but that is the project’s design goal, not an independent comparison or ranking. Project documentation

As an Amazon Associate I earn from qualifying purchases.

Because execution state is stored in the database rather than only in one process’s memory, a restart does not inherently erase scheduled executions. Multiple scheduler instances can use the same database to coordinate pickup. Depending on polling strategy, the project documents optimistic locking or select-for-update to prevent two instances from claiming the same execution. That coordination does not make task handlers exactly-once: a process can fail around the time it performs an external side effect, so handlers that cannot safely repeat should be designed with idempotency or their own transactional safeguards.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

What you need before adopting it

  • Java 17 or later: this is the documented minimum in the project README.
  • A relational database: scheduled execution state is persisted in a database table. Account for schema creation, database access, and routine database operations in the service’s deployment plan.
  • A compatible database and polling strategy: database engines differ in documented locking support and timestamp requirements; check the current compatibility notes and schema before choosing a pairing.

The official releases page listed v16.12.0 as the latest release when the reviewed release information was retrieved. The README’s dependency example shows 16.11.0, so use the release page to confirm the version and notes you intend to deploy rather than treating the example as current.

Database support and locking differences

The README lists PostgreSQL, SQL Server, MySQL, MariaDB, Oracle, SQLite, and HSQLDB. Its compatibility table distinguishes generic fetch from lock-and-fetch support. The table below summarizes that documented distinction; it is not a substitute for checking the current schema and engine-specific setup instructions.

Database Documented fetch support Documented lock-and-fetch support
PostgreSQL Yes Yes
SQL Server Yes Yes
MySQL 8+ Yes Yes
MariaDB Yes Not listed
Oracle Yes Not listed
SQLite Yes Not listed
HSQLDB Yes Not listed

“Not listed” means the README compatibility table does not identify lock-and-fetch support for that engine; it should not be read as a claim that the database cannot be used. The project also calls out engine-specific timestamp handling: MySQL and MariaDB require UTC persistence, while Oracle has timestamp-type guidance. Confirm those instructions against the version and database configuration you will run. Database compatibility and schema documentation

Schedules, polling, and the limits of timing guarantees

The library supports one-time executions, recurring tasks with static schedules, and recurring tasks whose schedules are persisted dynamically at runtime. Documented recurring schedule types include fixed delay, daily schedules with optional time zones, and Spring-style cron expressions. SchedulerClient can list, schedule, reschedule, and remove persisted executions. These operations make it possible to inspect or change scheduled work through application code rather than relying only on in-memory timers. Scheduling and SchedulerClient documentation

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

The README gives defaults of 10 scheduler threads and a 10-second polling interval. Polling affects when a due execution is noticed: absent an early check, the scheduler checks the database on its configured interval. A polling interval is not a promise that a task starts at an exact wall-clock instant; workload, database response, and execution capacity also matter.

More importantly, recurring work is not a guaranteed replay of every nominal schedule point. The project states: “There are no guarantees that all instants in a schedule for a RecurringTask will be executed.” The next time is calculated after the previous task finishes. If a task runs longer than the interval, or the application is unavailable, db-scheduler should not be assumed to queue one run for every missed instant. For strict catch-up, accounting, or deadline requirements, define that behavior explicitly in the application or choose a system whose documented semantics meet those requirements. Project README

Retries and recovery after failure

Failure behavior depends on whether the execution is one-time or recurring. The README documents that recurring tasks are rescheduled according to their schedule by default, while failed one-time tasks retry after five minutes. A dead execution, such as one left behind by a JVM exit with a stale heartbeat, is handled by a configurable dead-execution handler; the documented default revives it by rescheduling it to run now. These defaults are useful starting points, not a universal recovery policy: assess how retries interact with the task’s side effects and whether retry timing is appropriate for your workload. Failure and dead-execution handling

Task data is serialized, with Java serialization as the default and Gson, Jackson, and Kotlin options documented. Persisted payloads may outlive the application version that wrote them, so changes to task-data classes and serializers need a compatibility plan. Treat rolling upgrades and old queued executions as part of the schema and application migration design.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

Spring Boot integration

The project provides Spring Boot starter modules and documents exposing task definitions as beans. It distinguishes a starter for Spring Boot 3.x from a separate Boot 4 starter, and describes optional health information and configuration through properties or override beans. Confirm the current project instructions for the exact starter artifact and supported framework version before adding the dependency; framework compatibility can change between releases. Spring Boot integration documentation

When db-scheduler is a sensible choice

  • Consider it when a Java service needs one-time or recurring work to survive process restarts, and a relational database is already an acceptable operational dependency.
  • Consider it when several application instances should coordinate task pickup, and the selected database’s documented fetch and locking behavior matches the deployment.
  • Plan additional logic when business rules require catching up every missed interval, exact-time starts, or protection against repeated external side effects.
  • Evaluate alternatives when the added database table, database-specific setup, or serializer and migration responsibilities are a poor fit for the service.

The README also says the project is “Tested to handle 2k – 10k executions / second.” It does not provide a publication year, workload description, or benchmark methodology in the cited passage, so that project-reported figure should not be treated as an independently verified throughput guarantee or used alone for capacity planning. Project README

Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.

Leave a Reply

Your email address will not be published. Required fields are marked *

What’s actually slowing this PC down?

Pick the symptom - the matching free tool is one click away.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

More from the Wire

  1. World desk4 min
    How to Spot an AI Voice Scam Before Sending MoneyDon’t rely on how a caller sounds. Pause, call back through a known number, and verify the emergency with another trusted person before sending money.
  2. Mountain View desk4 min
    Google’s SynthID Detector: How to Check AI-Generated Images, Video and AudioGoogle’s SynthID Detector looks for an embedded watermark in supported images, video and audio. Here is what its results do—and do not—show.
  3. Redmond desk20 min
    How to create a link to File or Folder in Windows 11Windows 11 gives you several ways to point to a file or folder without moving or duplicating it. You can create a desktop shortcut,…
Recommended PC Tool
Recommended PC Tool
Crashes, No Sound, or Screen Glitches?Free driver scan
PC Slower Than It Used to Be?Free scan - under a minute

Two free Windows tools

One Free Minute Could Fix That PC

Before you go - each of these free tools takes about a minute and tackles what quietly slows a Windows PC down.

Special offer. View Outbyte info, uninstall instructions, EULA, and Privacy Policy.