Quartz scheduler Interview Questions and Answers

What is Quartz?

Quartz scheduler:
Quartz is an open source job scheduling framework that can be integrated into a wide variety of Java applications.

Where to use quartz scheduler?

If our application have tasks to run on a predefine date and time then quartz scheduler is the ideal solution.

See more at: JavaMail API architecture.

Explain Quartz 2 JobListener.

JobListener:
JobListener provides the facility to track the status of running jobs. To write a JobListener we have to implements the JobListener interface.

See more at: Quartz 2 JobListener example.

Explain Quartz multiple jobs.

Quartz scheduler:
Quartz is an open source job scheduling framework that can be integrated into a wide variety of Java applications to run task on a predefine date and time.
Steps:
1. Create multiple jobs by implementing Job interface.
2. Perform your business logic in the execute method.
3. Create a class for executing multiple quartz jobs.
4. Get JobDetail object from JobBuilder and set job detail like name and job class for each job.
5. Create Trigger object from TriggerBuilder and set the scheduler details for each job.
6. Get Scheduler object from StdSchedulerFactory.
7. Use Scheduler object to connect quartz job and quartz trigger together and execute the job.

See more at: Quartz multiple jobs example.