Struts 2 and Quartz 2 scheduler integration

To integrate Struts 2 and Quartz 2 scheduler we have to use a standard Servlet Listener which links both frameworks together. To create a standard Servlet Listener class implements ServletContextListener interface. ServletContextListener interface provides contextInitialized() method which is executed automatically at the time of Servlet container initialization. Servlet Listener invokes the Quartz scheduler framework in … Read more

Quartz listing all jobs example

Example Explanation: 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 … Read more

Quartz multiple jobs example

Example Explanation: 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 … Read more

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. Example: SimpleTriggerTest.java import org.quartz.JobBuilder; import org.quartz.JobDetail; import org.quartz.JobKey; import org.quartz.Scheduler; import org.quartz.SimpleScheduleBuilder; import org.quartz.Trigger; import org.quartz.TriggerBuilder; import org.quartz.impl.StdSchedulerFactory; import org.quartz.impl.matchers.KeyMatcher;   /** * This class is used for executing quartz job * … Read more

Quartz 2.1.5 hello world example using CronTrigger

Example Explanation: 1. Create a job by implementing Job interface. 2. Perform your business logic in the execute method. 3. Create a class for executing quartz job. 4. Get a JobDetail object from JobBuilder and set job detail like name and job class. 5. Create Trigger object from TriggerBuilder and set the scheduler timing and … Read more

Quartz 2.1.5 hello world example using SimpleTrigger

Example Explanation: 1. Create a job by implementing Job interface. 2. Perform your business logic in the execute method. 3. Create a class for executing quartz job. 4. Get a JobDetail object from JobBuilder and set job detail like name and job class. 5. Create Trigger object from TriggerBuilder and set the scheduler timing and … Read more

Quartz 1.6 hello world example using CronTrigger

Example Explanation: 1. Create a job by implementing Job interface. 2. Perform your business logic in the execute method. 3. Create a class for executing quartz job. 4. Create a JobDetail object and set job detail like name and job class. 5. Create CronTrigger object and set the scheduler timing and other details. 6. Get … Read more

Quartz 1.6 hello world example using SimpleTrigger

Example Explanation: 1. Create a job by implementing Job interface. 2. Perform your business logic in the execute method. 3. Create a class for executing quartz job. 4. Create a JobDetail object and set job detail like name and job class. 5. Create SimpleTrigger object and set the scheduler timing and other details. 6. Get … Read more

Quartz scheduler components

Quartz job: Quartz job is used for the logic or code which you want to execute. It implements org.quartz.Job interface. Quartz trigger: Quartz trigger is used to define the moment when the quartz scheduler will execute quartz’s job. Types of quartz trigger: 1. SimpleTrigger – SimpleTrigger setting start time, end time, repeat count and repeat … Read more