http://quartz-scheduler.org/documentation/quartz-2.x/cookbook/defines many examples of how to use quartz
1, Initialize Scheduler
Initialize the scheduler, one is to create a stdschedulerfactory first, and then from Stdschedulerfactory.getscheduler (), the scheduler obtained here is the default configuration. The other is to initialize the scheduler from the configuration file.
New= Sf.getscheduler ();
2,scheduler can be in standby mode, or "standby" mode, scheduler in this mode cannot trigger job execution conditions and cannot execute jobs.
Scheduler.standby (); // To put the scheduler into "standby" mode
Recover from "standby" mode, execute: Scheduler.start ();
3, Close Scheduler
Call the Shutdown () method to close scheduler, and once the shutdown method is called, the scheduler can no longer restart because its resources and related threads have been recycled.
When you close the scheduler, you face two situations. One is to close the scheduler while waiting for job execution to complete, and the other is to close the scheduler immediately. The parameters received by the shutdown method are used to determine which case.
Scheduler.shutdown (true); // wait for job execution to complete before shutting down the scheduler
Scheduler.shutdown (); // Shutdown Scheduler directly // orScheduler.shutdown (false); // Shutdown Scheduler directly
4,quartz can be integrated with the Web. When scheduler can be initialized in a servlet container, the appropriate configuration is required in the Web. xml file. Reference: Servletinitscheduler
5, use multiple scheduler in non-clustered mode (multiple work thread can be configured under each scheduler (configured in quartz.properties file))
For quartz, each scheduler must have a unique name, that is, different scheduler names must be different. The Quartz.properties file specifies the scheduler name for the scheduler. This means that more than one quartz.properties file is required, and each file is given a corresponding property configuration for a scheduler.
6, save the job for later use.
// ADD The job to the scheduler ' s store false);
7, how to update a job that already exists
8, how to update the trigger
9, List all jobs dispatched by the scheduler
10 .... Some very common small examples of using quartz .....
Quartz Scheduler Learning (2)