Quartz jobDetail requestRecovery

The documentation for the JobDetail.requestsRecovery property states the following

Tells the Scheduler whether to repeat the task if a "restore" or "failure" occurs.

Now, what is a “recovery” situation or a “failure” situation?

How do they differ?

Does recovery happen only if the JVM crashes while the job is running, or does it happen if the job is also not running due to an exception?

+6
source share
1 answer

A “Recovery state" is a general term; one type of recovery is failure.

A fail-over is a process used by fault tolerance systems commonly used with redundancy (e.g. clustering). The use of quartz during failure when used in clustering and other "nodes" of quartz exists.

Quote documentation :

A failure occurs when one of the nodes fails during the execution of one or more tasks. When a node fails, other nodes detect a condition and identify jobs in the database that were running on the failed node. Any jobs marked for recovery (with the "query recovery" property in JobDetail) will be re-run by the remaining nodes.

A recovery situation is any situation that creates a "Hard-shutdown" (that is, a process that runs in the event of a failure or machine shutdown).


To answer the second question:

  • If the JVM crashes while the job is running> Quartz will restore the job

    (Because an accident is a recovery situation)

  • if the task completes with an error due to an exception> Quartz will not restore the task

    (Since an exception is not a hard trip, a misfire is thrown instead)

See this answer to activate recovery for your jobs.

+6
source

Source: https://habr.com/ru/post/955553/


All Articles