Configs2026年5月23日·1 分钟阅读

Quartz — Enterprise Job Scheduling for Java

Feature-rich open-source job scheduling library for Java that supports cron expressions, clustering, and persistent job stores.

Agent 就绪

这个资产可以被 Agent 直接读取和安装

TokRepo 同时提供通用 CLI 命令、安装契约、metadata JSON、按适配器生成的安装计划和原始内容链接,方便 Agent 判断适配度、风险和下一步动作。

Native · 98/100策略:允许
Agent 入口
任意 MCP/CLI Agent
类型
Skill
安装
Single
信任
信任等级:Established
入口
Quartz Overview
通用 CLI 安装命令
npx tokrepo install 6369fc9f-56e6-11f1-9bc6-00163e2b0d79

Introduction

Quartz is a widely adopted open-source job scheduling library for Java applications. It lets developers define jobs as simple Java classes and schedule them using cron expressions, intervals, or calendar-based triggers. Quartz can run embedded within an application server or as a standalone process, and supports clustering across multiple nodes with JDBC-backed job stores for persistence and failover.

What Quartz Does

  • Schedules jobs using cron expressions, fixed intervals, or calendar rules
  • Persists job definitions and triggers to a relational database via JDBC
  • Supports clustered execution where multiple scheduler instances share work
  • Provides listeners and plugins for job lifecycle events, logging, and history
  • Handles misfired triggers with configurable recovery policies

Architecture Overview

A Quartz Scheduler manages a JobStore that holds job definitions and trigger states. The RAMJobStore keeps everything in memory for fast single-node use, while the JDBCJobStore persists to a database for durability and clustering. A thread pool of configurable size executes jobs when their triggers fire. In clustered mode, multiple Scheduler instances use database row-level locking to coordinate trigger ownership, ensuring each job fires exactly once across the cluster.

Self-Hosting & Configuration

  • Add org.quartz-scheduler:quartz to your Maven or Gradle dependencies
  • Configure via quartz.properties with thread pool size, job store type, and data source
  • Define jobs by implementing the org.quartz.Job interface
  • Build triggers with the fluent TriggerBuilder and CronScheduleBuilder APIs
  • For clustering, set org.quartz.jobStore.isClustered = true and point all nodes at the same database

Key Features

  • Cron expressions support second-level granularity beyond standard Unix cron
  • JDBC job store provides persistence across application restarts
  • Built-in clustering with automatic failover and load balancing
  • Misfire handling policies let you skip, fire immediately, or reschedule missed triggers
  • Calendar exclusions can block job execution on holidays or maintenance windows

Comparison with Similar Tools

  • Spring @Scheduled — simple annotation-based cron for Spring apps; Quartz adds persistence and clustering
  • Temporal — durable workflow orchestration; Quartz is lighter for simple job scheduling
  • Celery Beat — Python periodic task scheduler; Quartz serves the Java/JVM ecosystem
  • Hangfire — .NET background jobs; Quartz is the Java equivalent with JDBC stores
  • Airflow — DAG-based workflow orchestration; Quartz handles individual recurring jobs

FAQ

Q: Can Quartz run in a Spring Boot application? A: Yes. Spring Boot has built-in auto-configuration for Quartz via the spring-boot-starter-quartz dependency.

Q: How does Quartz handle a missed job trigger? A: Configurable misfire instructions let you fire immediately, discard the missed run, or reschedule to the next valid time.

Q: Does Quartz support distributed execution across servers? A: Yes. Configure JDBC job store with clustering enabled and all nodes sharing the same database.

Q: What databases does the JDBC job store support? A: Quartz provides SQL scripts for PostgreSQL, MySQL, Oracle, SQL Server, H2, and other databases.

Sources

讨论

登录后参与讨论。
还没有评论,来写第一条吧。

相关资产