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.
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 other details.
6. Get Scheduler object from StdSchedulerFactory.
7. Use Scheduler object to connect quartz job and quartz trigger together and execute the job.
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 other details.
6. Get Scheduler object from StdSchedulerFactory.
7. Use Scheduler object to connect quartz job and quartz trigger together and execute the job.
Example:
CronTriggerTest.java
HelloJob.java
No comments:
Post a Comment