Job Tips
Waiting For Conditions
Long-running jobs prevent others from running (if all threads in the ThreadPool are busy).
If you feel the need to call Thread.sleep() on the worker thread executing the job, it is typically a sign that the job is not ready to do the rest of its work because it needs to wait for some condition (such as the availability of a data record) to become true.
A better solution is to release the worker thread (exit the job) and allow other jobs to execute on that thread. The job can reschedule itself, or other jobs before it exits.
Throwing Exceptions
A job's execute method should contain a try-catch block that handles all possible exceptions.
If a job throws an exception, Quartz will typically immediately re-execute it (and it will likely throw the same exception again). It’s better if the job catches all exceptions it might encounter, handle them, and reschedule itself, or other jobs. to work around the issue.
Recoverability and Idempotence
In-progress jobs marked "recoverable" are automatically re-executed after a scheduler fails. This means some of the job's "work" will be executed twice.
This means the job should be coded in such a way that its work is idempotent.