What is quartz?
Quartz is a opensymphony open source organization in the Job scheduling (Task Scheduler) field another open source project, which can be combined with the Java EE and J2SE application can also be used alone. Quartz can be used to create a simple or complex day table that runs 10, hundreds, or even tens of thousands of jobs. Jobs can be made into standard Java components or EJBs. we have calendars on our phones, we can not only look at the date, but also add activities, time to trigger. Quartz is a task scheduling management system (acting as an alarm), a system that executes (or notifies) other software components when a predetermined (scheduled) time arrives . Quartz publishes a file (. jar file) with a small Java library that contains all the quartz core features. The primary interface (API) for these features is the scheduler interface. It provides simple operations such as scheduling tasks or canceling them from the schedule, starting/stopping/pausing schedule progress.
It's easy to think that quartz is a timer.
For some simple tasks, do not use quartz can also, such as the execution of every minute, not applicable quartz, can start a thread, do a dead loop, the middle stop a minute
Download:
Core interface
scheduler– Core Schedulerjob– Tasksjobdetail– Task DescriptionTrigger--Trigger
In these interfaces, the trigger interface is the most important interface, and it is divided into two categories
- Simpletrigger
- Crontrigger
the Simpletrigger is used to trigger a task that only executes once or is triggered at a given time and repeats n times for a certain amount of time per execution. • If you want the trigger to execute on January 11, 2014, 11:23:54 seconds, then repeat once every 10 seconds, and repeat 5 times. Then Simpletrigger will be able to meet your requirements. • Crontriggers is usually more useful than simpletrigger if you need to trigger tasks on a schedule like a calendar instead of triggering each interval at specific intervals like Simpletrigger. • With Crontrigger, you can specify a schedule such as "Every Friday noon" or "9:30 per weekday" or "every five minutes from 9:00 to 10:00 every Monday, Wednesday, and Friday". Even, like Simpletrigger, Crontrigger has a starttime to specify when the schedule starts, and an (optional) Endtime to specify when the schedule no longer continues.
Quartz Getting Started