Quartz1.8.5例子
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了Quartz1.8.5例子相关的知识,希望对你有一定的参考价值。
/* * Copyright 2005 - 2009 Terracotta, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not * use this file except in compliance with the License. You may obtain a copy * of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the * License for the specific language governing permissions and limitations * under the License. * */ package org.quartz.examples.example3; import java.util.Date; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.quartz.Job; import org.quartz.JobExecutionContext; import org.quartz.JobExecutionException; /** * <p> * This is just a simple job that gets fired off many times by example 1 * </p> * * @author Bill Kratzer */ public class SimpleJob implements Job { private static Logger _log = LoggerFactory.getLogger(SimpleJob.class); /** * Quartz requires a public empty constructor so that the * scheduler can instantiate the class whenever it needs. */ public SimpleJob() { } /** * <p> * Called by the <code>{@link org.quartz.Scheduler}</code> when a * <code>{@link org.quartz.Trigger}</code> fires that is associated with * the <code>Job</code>. * </p> * * @throws JobExecutionException * if there is an exception while executing the job. */ public void execute(JobExecutionContext context) throws JobExecutionException { // This job simply prints out its job name and the // date and time that it is running String jobName = context.getJobDetail().getFullName(); _log.info("SimpleJob says: " + jobName + " executing at " + new Date()); } }
/* * Copyright 2005 - 2009 Terracotta, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not * use this file except in compliance with the License. You may obtain a copy * of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the * License for the specific language governing permissions and limitations * under the License. * */ package org.quartz.examples.example3; import java.util.Date; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.quartz.CronTrigger; import org.quartz.JobDetail; import org.quartz.Scheduler; import org.quartz.SchedulerFactory; import org.quartz.SchedulerMetaData; import org.quartz.impl.StdSchedulerFactory; /** * This Example will demonstrate all of the basics of scheduling capabilities of * Quartz using Cron Triggers. * * @author Bill Kratzer */ public class CronTriggerExample { public void run() throws Exception { Logger log = LoggerFactory.getLogger(CronTriggerExample.class); log.info("------- Initializing -------------------"); // First we must get a reference to a scheduler SchedulerFactory sf = new StdSchedulerFactory(); Scheduler sched = sf.getScheduler(); log.info("------- Initialization Complete --------"); log.info("------- Scheduling Jobs ----------------"); // jobs can be scheduled before sched.start() has been called // job 1 will run every 20 seconds JobDetail job = new JobDetail("job1", "group1", SimpleJob.class); CronTrigger trigger = new CronTrigger("trigger1", "group1", "job1", "group1", "0/20 * * * * ?"); sched.addJob(job, true); Date ft = sched.scheduleJob(trigger); log.info(job.getFullName() + " has been scheduled to run at: " + ft + " and repeat based on expression: " + trigger.getCronExpression()); // job 2 will run every other minute (at 15 seconds past the minute) job = new JobDetail("job2", "group1", SimpleJob.class); trigger = new CronTrigger("trigger2", "group1", "job2", "group1", "15 0/2 * * * ?"); sched.addJob(job, true); ft = sched.scheduleJob(trigger); log.info(job.getFullName() + " has been scheduled to run at: " + ft + " and repeat based on expression: " + trigger.getCronExpression()); // job 3 will run every other minute but only between 8am and 5pm job = new JobDetail("job3", "group1", SimpleJob.class); trigger = new CronTrigger("trigger3", "group1", "job3", "group1", "0 0/2 8-17 * * ?"); sched.addJob(job, true); ft = sched.scheduleJob(trigger); log.info(job.getFullName() + " has been scheduled to run at: " + ft + " and repeat based on expression: " + trigger.getCronExpression()); // job 4 will run every three minutes but only between 5pm and 11pm job = new JobDetail("job4", "group1", SimpleJob.class); trigger = new CronTrigger("trigger4", "group1", "job4", "group1", "0 0/3 17-23 * * ?"); sched.addJob(job, true); ft = sched.scheduleJob(trigger); log.info(job.getFullName() + " has been scheduled to run at: " + ft + " and repeat based on expression: " + trigger.getCronExpression()); // job 5 will run at 10am on the 1st and 15th days of the month job = new JobDetail("job5", "group1", SimpleJob.class); trigger = new CronTrigger("trigger5", "group1", "job5", "group1", "0 0 10am 1,15 * ?"); sched.addJob(job, true); ft = sched.scheduleJob(trigger); log.info(job.getFullName() + " has been scheduled to run at: " + ft + " and repeat based on expression: " + trigger.getCronExpression()); // job 6 will run every 30 seconds but only on Weekdays (Monday through // Friday) job = new JobDetail("job6", "group1", SimpleJob.class); trigger = new CronTrigger("trigger6", "group1", "job6", "group1", "0,30 * * ? * MON-FRI"); sched.addJob(job, true); ft = sched.scheduleJob(trigger); log.info(job.getFullName() + " has been scheduled to run at: " + ft + " and repeat based on expression: " + trigger.getCronExpression()); // job 7 will run every 30 seconds but only on Weekends (Saturday and // Sunday) job = new JobDetail("job7", "group1", SimpleJob.class); trigger = new CronTrigger("trigger7", "group1", "job7", "group1", "0,30 * * ? * SAT,SUN"); sched.addJob(job, true); ft = sched.scheduleJob(trigger); log.info(job.getFullName() + " has been scheduled to run at: " + ft + " and repeat based on expression: " + trigger.getCronExpression()); log.info("------- Starting Scheduler ----------------"); // All of the jobs have been added to the scheduler, but none of the // jobs // will run until the scheduler has been started sched.start(); log.info("------- Started Scheduler -----------------"); log.info("------- Waiting five minutes... ------------"); try { // wait five minutes to show jobs Thread.sleep(300L * 1000L); // executing... } catch (Exception e) { } log.info("------- Shutting Down ---------------------"); sched.shutdown(true); log.info("------- Shutdown Complete -----------------"); SchedulerMetaData metaData = sched.getMetaData(); log.info("Executed " + metaData.getNumberOfJobsExecuted() + " jobs."); } public static void main(String[] args) throws Exception { CronTriggerExample example = new CronTriggerExample(); example.run(); } }
Example 3
=========
Overview:
=========
This example will demonstrate how to use Cron Triggers.
Running the Example:
====================
1. Windows users - Modify the example3.bat file (if necessary)
to set your JAVA_HOME. Run example3.bat
2. UNIX/Linux users - Modify the example3.sh file (if necessary)
to set your JAVA_HOME. Execute example3.sh
Configuration Files:
====================
1. You can decide to specify a log4j.properties file to
control logging output (optional)
[INFO] 02 二月 01:42:19.418 下午 main [org.quartz.examples.example3.CronTriggerExample] ------- Initializing ------------------- [INFO] 02 二月 01:42:19.440 下午 main [org.quartz.simpl.SimpleThreadPool] Job execution threads will use class loader of thread: main [INFO] 02 二月 01:42:19.454 下午 main [org.quartz.core.SchedulerSignalerImpl] Initialized Scheduler Signaller of type: class org.quartz.core.SchedulerSignalerImpl [INFO] 02 二月 01:42:19.455 下午 main [org.quartz.core.QuartzScheduler] Quartz Scheduler v.1.8.5 created. [INFO] 02 二月 01:42:19.456 下午 main [org.quartz.simpl.RAMJobStore] RAMJobStore initialized. [INFO] 02 二月 01:42:19.457 下午 main [org.quartz.core.QuartzScheduler] Scheduler meta-data: Quartz Scheduler (v1.8.5) ‘DefaultQuartzScheduler‘ with instanceId ‘NON_CLUSTERED‘ Scheduler class: ‘org.quartz.core.QuartzScheduler‘ - running locally. NOT STARTED. Currently in standby mode. Number of jobs executed: 0 Using thread pool ‘org.quartz.simpl.SimpleThreadPool‘ - with 10 threads. Using job-store ‘org.quartz.simpl.RAMJobStore‘ - which does not support persistence. and is not clustered. [INFO] 02 二月 01:42:19.457 下午 main [org.quartz.impl.StdSchedulerFactory] Quartz scheduler ‘DefaultQuartzScheduler‘ initialized from default resource file in Quartz package: ‘quartz.properties‘ [INFO] 02 二月 01:42:19.457 下午 main [org.quartz.impl.StdSchedulerFactory] Quartz scheduler version: 1.8.5 [INFO] 02 二月 01:42:19.457 下午 main [org.quartz.examples.example3.CronTriggerExample] ------- Initialization Complete -------- [INFO] 02 二月 01:42:19.457 下午 main [org.quartz.examples.example3.CronTriggerExample] ------- Scheduling Jobs ---------------- [INFO] 02 二月 01:42:19.527 下午 main [org.quartz.examples.example3.CronTriggerExample] group1.job1 has been scheduled to run at: Tue Feb 02 13:42:20 CST 2016 and repeat based on expression: 0/20 * * * * ? [INFO] 02 二月 01:42:19.528 下午 main [org.quartz.examples.example3.CronTriggerExample] group1.job2 has been scheduled to run at: Tue Feb 02 13:44:15 CST 2016 and repeat based on expression: 15 0/2 * * * ? [INFO] 02 二月 01:42:19.530 下午 main [org.quartz.examples.example3.CronTriggerExample] group1.job3 has been scheduled to run at: Tue Feb 02 13:44:00 CST 2016 and repeat based on expression: 0 0/2 8-17 * * ? [INFO] 02 二月 01:42:19.531 下午 main [org.quartz.examples.example3.CronTriggerExample] group1.job4 has been scheduled to run at: Tue Feb 02 17:00:00 CST 2016 and repeat based on expression: 0 0/3 17-23 * * ? [INFO] 02 二月 01:42:19.533 下午 main [org.quartz.examples.example3.CronTriggerExample] group1.job5 has been scheduled to run at: Mon Feb 15 10:00:00 CST 2016 and repeat based on expression: 0 0 10AM 1,15 * ? [INFO] 02 二月 01:42:19.535 下午 main [org.quartz.examples.example3.CronTriggerExample] group1.job6 has been scheduled to run at: Tue Feb 02 13:42:30 CST 2016 and repeat based on expression: 0,30 * * ? * MON-FRI [INFO] 02 二月 01:42:19.536 下午 main [org.quartz.examples.example3.CronTriggerExample] group1.job7 has been scheduled to run at: Sat Feb 06 00:00:00 CST 2016 and repeat based on expression: 0,30 * * ? * SAT,SUN [INFO] 02 二月 01:42:19.536 下午 main [org.quartz.examples.example3.CronTriggerExample] ------- Starting Scheduler ---------------- [INFO] 02 二月 01:42:19.536 下午 main [org.quartz.core.QuartzScheduler] Scheduler DefaultQuartzScheduler_$_NON_CLUSTERED started. [INFO] 02 二月 01:42:19.537 下午 main [org.quartz.examples.example3.CronTriggerExample] ------- Started Scheduler ----------------- [INFO] 02 二月 01:42:19.537 下午 main [org.quartz.examples.example3.CronTriggerExample] ------- Waiting five minutes... ------------ [DEBUG] 02 二月 01:42:20.007 下午 DefaultQuartzScheduler_QuartzSchedulerThread [org.quartz.simpl.SimpleJobFactory] Producing instance of Job ‘group1.job1‘, class=org.quartz.examples.example3.SimpleJob [DEBUG] 02 二月 01:42:20.025 下午 DefaultQuartzScheduler_Worker-1 [org.quartz.core.JobRunShell] Calling execute on job group1.job1 [INFO] 02 二月 01:42:20.026 下午 DefaultQuartzScheduler_Worker-1 [org.quartz.examples.example3.SimpleJob] SimpleJob says: group1.job1 executing at Tue Feb 02 13:42:20 CST 2016 [DEBUG] 02 二月 01:42:20.455 下午 Timer-0 [org.quartz.utils.UpdateChecker] Checking for available updated version of Quartz... [DEBUG] 02 二月 01:42:30.000 下午 DefaultQuartzScheduler_QuartzSchedulerThread [org.quartz.simpl.SimpleJobFactory] Producing instance of Job ‘group1.job6‘, class=org.quartz.examples.example3.SimpleJob [DEBUG] 02 二月 01:42:30.001 下午 DefaultQuartzScheduler_Worker-2 [org.quartz.core.JobRunShell] Calling execute on job group1.job6 [INFO] 02 二月 01:42:30.001 下午 DefaultQuartzScheduler_Worker-2 [org.quartz.examples.example3.SimpleJob] SimpleJob says: group1.job6 executing at Tue Feb 02 13:42:30 CST 2016 [DEBUG] 02 二月 01:42:40.002 下午 DefaultQuartzScheduler_QuartzSchedulerThread [org.quartz.simpl.SimpleJobFactory] Producing instance of Job ‘group1.job1‘, class=org.quartz.examples.example3.SimpleJob [DEBUG] 02 二月 01:42:40.003 下午 DefaultQuartzScheduler_Worker-3 [org.quartz.core.JobRunShell] Calling execute on job group1.job1 [INFO] 02 二月 01:42:40.004 下午 DefaultQuartzScheduler_Worker-3 [org.quartz.examples.example3.SimpleJob] SimpleJob says: group1.job1 executing at Tue Feb 02 13:42:40 CST 2016 [DEBUG] 02 二月 01:43:00.001 下午 DefaultQuartzScheduler_QuartzSchedulerThread [org.quartz.simpl.SimpleJobFactory] Producing instance of Job ‘group1.job1‘, class=org.quartz.examples.example3.SimpleJob [DEBUG] 02 二月 01:43:00.002 下午 DefaultQuartzScheduler_Worker-4 [org.quartz.core.JobRunShell] Calling execute on job group1.job1 [INFO] 02 二月 01:43:00.002 下午 DefaultQuartzScheduler_Worker-4 [org.quartz.examples.example3.SimpleJob] SimpleJob says: group1.job1 executing at Tue Feb 02 13:43:00 CST 2016 [DEBUG] 02 二月 01:43:00.003 下午 DefaultQuartzScheduler_QuartzSchedulerThread [org.quartz.simpl.SimpleJobFactory] Producing instance of Job ‘group1.job6‘, class=org.quartz.examples.example3.SimpleJob [DEBUG] 02 二月 01:43:00.005 下午 DefaultQuartzScheduler_Worker-5 [org.quartz.core.JobRunShell] Calling execute on job group1.job6 [INFO] 02 二月 01:43:00.005 下午 DefaultQuartzScheduler_Worker-5 [org.quartz.examples.example3.SimpleJob] SimpleJob says: group1.job6 executing at Tue Feb 02 13:43:00 CST 2016 [DEBUG] 02 二月 01:43:20.001 下午 DefaultQuartzScheduler_QuartzSchedulerThread [org.quartz.simpl.SimpleJobFactory] Producing instance of Job ‘group1.job1‘, class=org.quartz.examples.example3.SimpleJob [DEBUG] 02 二月 01:43:20.002 下午 DefaultQuartzScheduler_Worker-6 [org.quartz.core.JobRunShell] Calling execute on job group1.job1 [INFO] 02 二月 01:43:20.002 下午 DefaultQuartzScheduler_Worker-6 [org.quartz.examples.example3.SimpleJob] SimpleJob says: group1.job1 executing at Tue Feb 02 13:43:20 CST 2016 [DEBUG] 02 二月 01:43:30.006 下午 DefaultQuartzScheduler_QuartzSchedulerThread [org.quartz.simpl.SimpleJobFactory] Producing instance of Job ‘group1.job6‘, class=org.quartz.examples.example3.SimpleJob [DEBUG] 02 二月 01:43:30.007 下午 DefaultQuartzScheduler_Worker-7 [org.quartz.core.JobRunShell] Calling execute on job group1.job6 [INFO] 02 二月 01:43:30.007 下午 DefaultQuartzScheduler_Worker-7 [org.quartz.examples.example3.SimpleJob] SimpleJob says: group1.job6 executing at Tue Feb 02 13:43:30 CST 2016 [DEBUG] 02 二月 01:43:40.002 下午 DefaultQuartzScheduler_QuartzSchedulerThread [org.quartz.simpl.SimpleJobFactory] Producing instance of Job ‘group1.job1‘, class=org.quartz.examples.example3.SimpleJob [DEBUG] 02 二月 01:43:40.002 下午 DefaultQuartzScheduler_Worker-8 [org.quartz.core.JobRunShell] Calling execute on job group1.job1 [INFO] 02 二月 01:43:40.003 下午 DefaultQuartzScheduler_Worker-8 [org.quartz.examples.example3.SimpleJob] SimpleJob says: group1.job1 executing at Tue Feb 02 13:43:40 CST 2016 [DEBUG] 02 二月 01:44:00.001 下午 DefaultQuartzScheduler_QuartzSchedulerThread [org.quartz.simpl.SimpleJobFactory] Producing instance of Job ‘group1.job1‘, class=org.quartz.examples.example3.SimpleJob [DEBUG] 02 二月 01:44:00.002 下午 DefaultQuartzScheduler_Worker-9 [org.quartz.core.JobRunShell] Calling execute on job group1.job1 [INFO] 02 二月 01:44:00.002 下午 DefaultQuartzScheduler_Worker-9 [org.quartz.examples.example3.SimpleJob] SimpleJob says: group1.job1 executing at Tue Feb 02 13:44:00 CST 2016 [DEBUG] 02 二月 01:44:00.003 下午 DefaultQuartzScheduler_QuartzSchedulerThread [org.quartz.simpl.SimpleJobFactory] Producing instance of Job ‘group1.job3‘, class=org.quartz.examples.example3.SimpleJob [DEBUG] 02 二月 01:44:00.004 下午 DefaultQuartzScheduler_Worker-10 [org.quartz.core.JobRunShell] Calling execute on job group1.job3 [INFO] 02 二月 01:44:00.004 下午 DefaultQuartzScheduler_Worker-10 [org.quartz.examples.example3.SimpleJob] SimpleJob says: group1.job3 executing at Tue Feb 02 13:44:00 CST 2016 [DEBUG] 02 二月 01:44:00.005 下午 DefaultQuartzScheduler_QuartzSchedulerThread [org.quartz.simpl.SimpleJobFactory] Producing instance of Job ‘group1.job6‘, class=org.quartz.examples.example3.SimpleJob [DEBUG] 02 二月 01:44:00.005 下午 DefaultQuartzScheduler_Worker-1 [org.quartz.core.JobRunShell] Calling execute on job group1.job6 [INFO] 02 二月 01:44:00.006 下午 DefaultQuartzScheduler_Worker-1 [org.quartz.examples.example3.SimpleJob] SimpleJob says: group1.job6 executing at Tue Feb 02 13:44:00 CST 2016 [DEBUG] 02 二月 01:44:15.002 下午 DefaultQuartzScheduler_QuartzSchedulerThread [org.quartz.simpl.SimpleJobFactory] Producing instance of Job ‘group1.job2‘, class=org.quartz.examples.example3.SimpleJob [DEBUG] 02 二月 01:44:15.003 下午 DefaultQuartzScheduler_Worker-2 [org.quartz.core.JobRunShell] Calling execute on job group1.job2 [INFO] 02 二月 01:44:15.004 下午 DefaultQuartzScheduler_Worker-2 [org.quartz.examples.example3.SimpleJob] SimpleJob says: group1.job2 executing at Tue Feb 02 13:44:15 CST 2016 [DEBUG] 02 二月 01:44:20.002 下午 DefaultQuartzScheduler_QuartzSchedulerThread [org.quartz.simpl.SimpleJobFactory] Producing instance of Job ‘group1.job1‘, class=org.quartz.examples.example3.SimpleJob [DEBUG] 02 二月 01:44:20.002 下午 DefaultQuartzScheduler_Worker-3 [org.quartz.core.JobRunShell] Calling execute on job group1.job1 [INFO] 02 二月 01:44:20.003 下午 DefaultQuartzScheduler_Worker-3 [org.quartz.examples.example3.SimpleJob] SimpleJob says: group1.job1 executing at Tue Feb 02 13:44:20 CST 2016 [DEBUG] 02 二月 01:44:30.002 下午 DefaultQuartzScheduler_QuartzSchedulerThread [org.quartz.simpl.SimpleJobFactory] Producing instance of Job ‘group1.job6‘, class=org.quartz.examples.example3.SimpleJob [DEBUG] 02 二月 01:44:30.003 下午 DefaultQuartzScheduler_Worker-4 [org.quartz.core.JobRunShell] Calling execute on job group1.job6 [INFO] 02 二月 01:44:30.003 下午 DefaultQuartzScheduler_Worker-4 [org.quartz.examples.example3.SimpleJob] SimpleJob says: group1.job6 executing at Tue Feb 02 13:44:30 CST 2016 [DEBUG] 02 二月 01:44:40.002 下午 DefaultQuartzScheduler_QuartzSchedulerThread [org.quartz.simpl.SimpleJobFactory] Producing instance of Job ‘group1.job1‘, class=org.quartz.examples.example3.SimpleJob [DEBUG] 02 二月 01:44:40.003 下午 DefaultQuartzScheduler_Worker-5 [org.quartz.core.JobRunShell] Calling execute on job group1.job1 [INFO] 02 二月 01:44:40.003 下午 DefaultQuartzScheduler_Worker-5 [org.quartz.examples.example3.SimpleJob] SimpleJob says: group1.job1 executing at Tue Feb 02 13:44:40 CST 2016 [DEBUG] 02 二月 01:45:00.002 下午 DefaultQuartzScheduler_QuartzSchedulerThread [org.quartz.simpl.SimpleJobFactory] Producing instance of Job ‘group1.job1‘, class=org.quartz.examples.example3.SimpleJob [DEBUG] 02 二月 01:45:00.006 下午 DefaultQuartzScheduler_Worker-6 [org.quartz.core.JobRunShell] Calling execute on job group1.job1 [DEBUG] 02 二月 01:45:00.007 下午 DefaultQuartzScheduler_QuartzSchedulerThread [org.quartz.simpl.SimpleJobFactory] Producing instance of Job ‘group1.job6‘, class=org.quartz.examples.example3.SimpleJob [INFO] 02 二月 01:45:00.007 下午 DefaultQuartzScheduler_Worker-6 [org.quartz.examples.example3.SimpleJob] SimpleJob says: group1.job1 executing at Tue Feb 02 13:45:00 CST 2016 [DEBUG] 02 二月 01:45:00.007 下午 DefaultQuartzScheduler_Worker-7 [org.quartz.core.JobRunShell] Calling execute on job group1.job6 [INFO] 02 二月 01:45:00.008 下午 DefaultQuartzScheduler_Worker-7 [org.quartz.examples.example3.SimpleJob] SimpleJob says: group1.job6 executing at Tue Feb 02 13:45:00 CST 2016 [DEBUG] 02 二月 01:45:20.000 下午 DefaultQuartzScheduler_QuartzSchedulerThread [org.quartz.simpl.SimpleJobFactory] Producing instance of Job ‘group1.job1‘, class=org.quartz.examples.example3.SimpleJob [DEBUG] 02 二月 01:45:20.000 下午 DefaultQuartzScheduler_Worker-8 [org.quartz.core.JobRunShell] Calling execute on job group1.job1 [INFO] 02 二月 01:45:20.001 下午 DefaultQuartzScheduler_Worker-8 [org.quartz.examples.example3.SimpleJob] SimpleJob says: group1.job1 executing at Tue Feb 02 13:45:20 CST 2016 [DEBUG] 02 二月 01:45:30.001 下午 DefaultQuartzScheduler_QuartzSchedulerThread [org.quartz.simpl.SimpleJobFactory] Producing instance of Job ‘group1.job6‘, class=org.quartz.examples.example3.SimpleJob [DEBUG] 02 二月 01:45:30.002 下午 DefaultQuartzScheduler_Worker-9 [org.quartz.core.JobRunShell] Calling execute on job group1.job6 [INFO] 02 二月 01:45:30.002 下午 DefaultQuartzScheduler_Worker-9 [org.quartz.examples.example3.SimpleJob] SimpleJob says: group1.job6 executing at Tue Feb 02 13:45:30 CST 2016 [DEBUG] 02 二月 01:45:40.002 下午 DefaultQuartzScheduler_QuartzSchedulerThread [org.quartz.simpl.SimpleJobFactory] Producing instance of Job ‘group1.job1‘, class=org.quartz.examples.example3.SimpleJob [DEBUG] 02 二月 01:45:40.002 下午 DefaultQuartzScheduler_Worker-10 [org.quartz.core.JobRunShell] Calling execute on job group1.job1 [INFO] 02 二月 01:45:40.003 下午 DefaultQuartzScheduler_Worker-10 [org.quartz.examples.example3.SimpleJob] SimpleJob says: group1.job1 executing at Tue Feb 02 13:45:40 CST 2016 [DEBUG] 02 二月 01:46:00.002 下午 DefaultQuartzScheduler_QuartzSchedulerThread [org.quartz.simpl.SimpleJobFactory] Producing instance of Job ‘group1.job1‘, class=org.quartz.examples.example3.SimpleJob [DEBUG] 02 二月 01:46:00.002 下午 DefaultQuartzScheduler_Worker-1 [org.quartz.core.JobRunShell] Calling execute on job group1.job1 [INFO] 02 二月 01:46:00.003 下午 DefaultQuartzScheduler_Worker-1 [org.quartz.examples.example3.SimpleJob] SimpleJob says: group1.job1 executing at Tue Feb 02 13:46:00 CST 2016 [DEBUG] 02 二月 01:46:00.004 下午 DefaultQuartzScheduler_QuartzSchedulerThread [org.quartz.simpl.SimpleJobFactory] Producing instance of Job ‘group1.job3‘, class=org.quartz.examples.example3.SimpleJob [DEBUG] 02 二月 01:46:00.004 下午 DefaultQuartzScheduler_Worker-2 [org.quartz.core.JobRunShell] Calling execute on job group1.job3 [INFO] 02 二月 01:46:00.005 下午 DefaultQuartzScheduler_Worker-2 [org.quartz.examples.example3.SimpleJob] SimpleJob says: group1.job3 executing at Tue Feb 02 13:46:00 CST 2016 [DEBUG] 02 二月 01:46:00.006 下午 DefaultQuartzScheduler_QuartzSchedulerThread [org.quartz.simpl.SimpleJobFactory] Producing instance of Job ‘group1.job6‘, class=org.quartz.examples.example3.SimpleJob [DEBUG] 02 二月 01:46:00.007 下午 DefaultQuartzScheduler_Worker-3 [org.quartz.core.JobRunShell] Calling execute on job group1.job6 [INFO] 02 二月 01:46:00.007 下午 DefaultQuartzScheduler_Worker-3 [org.quartz.examples.example3.SimpleJob] SimpleJob says: group1.job6 executing at Tue Feb 02 13:46:00 CST 2016 [DEBUG] 02 二月 01:46:15.001 下午 DefaultQuartzScheduler_QuartzSchedulerThread [org.quartz.simpl.SimpleJobFactory] Producing instance of Job ‘group1.job2‘, class=org.quartz.examples.example3.SimpleJob [DEBUG] 02 二月 01:46:15.001 下午 DefaultQuartzScheduler_Worker-4 [org.quartz.core.JobRunShell] Calling execute on job group1.job2 [INFO] 02 二月 01:46:15.002 下午 DefaultQuartzScheduler_Worker-4 [org.quartz.examples.example3.SimpleJob] SimpleJob says: group1.job2 executing at Tue Feb 02 13:46:15 CST 2016 [DEBUG] 02 二月 01:46:20.001 下午 DefaultQuartzScheduler_QuartzSchedulerThread [org.quartz.simpl.SimpleJobFactory] Producing instance of Job ‘group1.job1‘, class=org.quartz.examples.example3.SimpleJob [DEBUG] 02 二月 01:46:20.003 下午 DefaultQuartzScheduler_Worker-5 [org.quartz.core.JobRunShell] Calling execute on job group1.job1 [INFO] 02 二月 01:46:20.003 下午 DefaultQuartzScheduler_Worker-5 [org.quartz.examples.example3.SimpleJob] SimpleJob says: group1.job1 executing at Tue Feb 02 13:46:20 CST 2016 [DEBUG] 02 二月 01:46:30.001 下午 DefaultQuartzScheduler_QuartzSchedulerThread [org.quartz.simpl.SimpleJobFactory] Producing instance of Job ‘group1.job6‘, class=org.quartz.examples.example3.SimpleJob [DEBUG] 02 二月 01:46:30.001 下午 DefaultQuartzScheduler_Worker-6 [org.quartz.core.JobRunShell] Calling execute on job group1.job6 [INFO] 02 二月 01:46:30.002 下午 DefaultQuartzScheduler_Worker-6 [org.quartz.examples.example3.SimpleJob] SimpleJob says: group1.job6 executing at Tue Feb 02 13:46:30 CST 2016 [DEBUG] 02 二月 01:46:40.002 下午 DefaultQuartzScheduler_QuartzSchedulerThread [org.quartz.simpl.SimpleJobFactory] Producing instance of Job ‘group1.job1‘, class=org.quartz.examples.example3.SimpleJob [DEBUG] 02 二月 01:46:40.002 下午 DefaultQuartzScheduler_Worker-7 [org.quartz.core.JobRunShell] Calling execute on job group1.job1 [INFO] 02 二月 01:46:40.003 下午 DefaultQuartzScheduler_Worker-7 [org.quartz.examples.example3.SimpleJob] SimpleJob says: group1.job1 executing at Tue Feb 02 13:46:40 CST 2016 [DEBUG] 02 二月 01:47:00.002 下午 DefaultQuartzScheduler_QuartzSchedulerThread [org.quartz.simpl.SimpleJobFactory] Producing instance of Job ‘group1.job1‘, class=org.quartz.examples.example3.SimpleJob [DEBUG] 02 二月 01:47:00.002 下午 DefaultQuartzScheduler_Worker-8 [org.quartz.core.JobRunShell] Calling execute on job group1.job1 [INFO] 02 二月 01:47:00.003 下午 DefaultQuartzScheduler_Worker-8 [org.quartz.examples.example3.SimpleJob] SimpleJob says: group1.job1 executing at Tue Feb 02 13:47:00 CST 2016 [DEBUG] 02 二月 01:47:00.004 下午 DefaultQuartzScheduler_QuartzSchedulerThread [org.quartz.simpl.SimpleJobFactory] Producing instance of Job ‘group1.job6‘, class=org.quartz.examples.example3.SimpleJob [DEBUG] 02 二月 01:47:00.004 下午 DefaultQuartzScheduler_Worker-9 [org.quartz.core.JobRunShell] Calling execute on job group1.job6 [INFO] 02 二月 01:47:00.005 下午 DefaultQuartzScheduler_Worker-9 [org.quartz.examples.example3.SimpleJob] SimpleJob says: group1.job6 executing at Tue Feb 02 13:47:00 CST 2016 [INFO] 02 二月 01:47:19.550 下午 main [org.quartz.examples.example3.CronTriggerExample] ------- Shutting Down --------------------- [INFO] 02 二月 01:47:19.551 下午 main [org.quartz.core.QuartzScheduler] Scheduler DefaultQuartzScheduler_$_NON_CLUSTERED shutting down. [INFO] 02 二月 01:47:19.551 下午 main [org.quartz.core.QuartzScheduler] Scheduler DefaultQuartzScheduler_$_NON_CLUSTERED paused. [DEBUG] 02 二月 01:47:19.552 下午 main [org.quartz.simpl.SimpleThreadPool] shutdown complete [INFO] 02 二月 01:47:19.553 下午 main [org.quartz.core.QuartzScheduler] Scheduler DefaultQuartzScheduler_$_NON_CLUSTERED shutdown complete. [INFO] 02 二月 01:47:19.553 下午 main [org.quartz.examples.example3.CronTriggerExample] ------- Shutdown Complete ----------------- [INFO] 02 二月 01:47:19.554 下午 main [org.quartz.examples.example3.CronTriggerExample] Executed 29 jobs. [DEBUG] 02 二月 01:47:19.645 下午 DefaultQuartzScheduler_Worker-9 [org.quartz.simpl.SimpleThreadPool] WorkerThread is shut down. [DEBUG] 02 二月 01:47:19.645 下午 DefaultQuartzScheduler_Worker-8 [org.quartz.simpl.SimpleThreadPool] WorkerThread is shut down. [DEBUG] 02 二月 01:47:19.740 下午 DefaultQuartzScheduler_Worker-10 [org.quartz.simpl.SimpleThreadPool] WorkerThread is shut down. [DEBUG] 02 二月 01:47:19.740 下午 DefaultQuartzScheduler_Worker-7 [org.quartz.simpl.SimpleThreadPool] WorkerThread is shut down. [DEBUG] 02 二月 01:47:19.832 下午 DefaultQuartzScheduler_Worker-6 [org.quartz.simpl.SimpleThreadPool] WorkerThread is shut down. [DEBUG] 02 二月 01:47:19.954 下午 DefaultQuartzScheduler_Worker-4 [org.quartz.simpl.SimpleThreadPool] WorkerThread is shut down. [DEBUG] 02 二月 01:47:19.954 下午 DefaultQuartzScheduler_Worker-5 [org.quartz.simpl.SimpleThreadPool] WorkerThread is shut down. [DEBUG] 02 二月 01:47:20.051 下午 DefaultQuartzScheduler_Worker-1 [org.quartz.simpl.SimpleThreadPool] WorkerThread is shut down. [DEBUG] 02 二月 01:47:20.051 下午 DefaultQuartzScheduler_Worker-3 [org.quartz.simpl.SimpleThreadPool] WorkerThread is shut down. [DEBUG] 02 二月 01:47:20.051 下午 DefaultQuartzScheduler_Worker-2 [org.quartz.simpl.SimpleThreadPool] WorkerThread is shut down.
以上是关于Quartz1.8.5例子的主要内容,如果未能解决你的问题,请参考以下文章