Quartz之CronTrigger

参考资料
1 quartz 学习笔记
http://chinaxxren.iteye.com/blog/897989
任务和触发器是quartz的两大块核心。触发器分CronTrigger 和SimpleTrigger
CronTrigger 支持比 SimpleTrigger 更具体的调度,而且也不是很复杂。基于 cron 表达式,CronTrigger 支持类似日历的重复间隔,而不是单一的时间间隔 —— 这相对 SimpleTrigger 而言是一大改进。掌握CronTrigger,是非常必要,掌握Quartz cron 表达式是学习CronTrigger的关键所在!

环境: XP+Myeclipse6.5+JDK1.6+Quartz2
一 具体代码
1 SimpleJob.java
package org.quartz.examples.example3;

import java.text.SimpleDateFormat;
import java.util.Date;

import org.quartz.Job;
import org.quartz.JobExecutionContext;
import org.quartz.JobExecutionException;
import org.quartz.JobKey;
import org.quartz.Scheduler;
import org.quartz.SchedulerException;
import org.quartz.TriggerKey;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

public class SimpleJob implements Job {
	
	private static int jobCount = 0;

    private static Logger _log = LoggerFactory.getLogger(SimpleJob.class);
    
    private Scheduler sched = null;
   
    public SimpleJob() throws SchedulerException {
    	sched = SchedFacory.getScheduler();
    }
   
    public void execute(JobExecutionContext context)
        throws JobExecutionException {
    	
        JobKey jobKey = context.getJobDetail().getKey();
        TriggerKey triggerKey = context.getTrigger().getKey();       
        
        //启动线程监听触发器的状态
        new Thread(new SchedEventLister(triggerKey)).start();   
        
        SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd hh:mm:ss");
        _log.info("任务分组名称: " + jobKey.getGroup()+",任务名称: " + jobKey.getName()+",触发器组名称: " + triggerKey.getGroup()+ ",触发器名称: "+triggerKey.getName()+" 执行时间: " + sdf.format(new Date()) + ",计数: " + (++jobCount)) ;
               
        //如果任务执行超过20次就结束它
      /*  if(jobCount > 5){
        	_log.warn("结束任务...");
        	try {
        		//Delete the identified Job from the Scheduler - and any associated Triggers.
        		//从调度器中删除这个唯一任务时同时会删除相关联的触发器^_^
				sched.deleteJob(jobKey);				
				sched.resumeJob(jobKey);
				
			} catch (SchedulerException e) {
				e.printStackTrace();
			}
        }*/
       if(jobCount == 15 ){
        	_log.warn("已经暂停了触发器...,触发器组名: " + triggerKey.getGroup()  + ",触发器名称: " + triggerKey.getName());
        	//暂停触发器        	
        	try {  
        		sched.pauseTrigger(triggerKey);  
            } catch (SchedulerException e) {  
                throw new RuntimeException(e);  
            }  
           
        }         
       
        
        if(jobCount == 20){
        	_log.error("正在停止并且移除触发器...,触发器组名: " + triggerKey.getGroup()  + ",触发器名称: " + triggerKey.getName());
        	try {  
        		sched.resumeTrigger(triggerKey);//停止触发器
        		sched.unscheduleJob(triggerKey);//移除触发器  
            } catch (SchedulerException e) {  
                throw new RuntimeException(e);  
            }             
        }
       
    }
}


2 CronTriggerExample.java
package org.quartz.examples.example3;

import static org.quartz.CronScheduleBuilder.cronSchedule;
import static org.quartz.JobBuilder.newJob;
import static org.quartz.TriggerBuilder.newTrigger;

import java.text.SimpleDateFormat;
import java.util.Date;

import org.quartz.CronTrigger;
import org.quartz.JobDetail;
import org.quartz.Scheduler;
import org.quartz.SchedulerMetaData;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;


public class CronTriggerExample {

    public void run() throws Exception {
    	
        Logger log = LoggerFactory.getLogger(CronTriggerExample.class);
      
        //SchedulerFactory sf = new StdSchedulerFactory();
        Scheduler sched = SchedFacory.getScheduler();// sf.getScheduler();    
    
        
        SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd hh:mm:ss");
        CronTrigger trigger = null;
        JobDetail job = null;
        Date ft = null;
        
       /* job = newJob(SimpleJob.class)
            .withIdentity("job1", "group1")
            .build();      
        
        //表示每20秒执行一次
        trigger = newTrigger()
            .withIdentity("trigger1", "group1")
            .withSchedule(cronSchedule("0/20 * * * * ?"))
            .build();*/
      
       /*  
        job = newJob(SimpleJob.class)
            .withIdentity("job2", "group1")
            .build();
        
        //每2分钟执行一次,并且启动时间为:15秒之后开始,例如: 2011-07-08 04:44:15,2011-07-08 04:46:15 ...
       trigger = newTrigger()
            .withIdentity("trigger2", "group1")
            .withSchedule(cronSchedule("15 0/2 * * * ?"))
            .build();*/        
       

       job = newJob(SimpleJob.class)
            .withIdentity("job3", "group1")
            .build();
        
        //在8-17之间每2分钟执行一次
        /*trigger = newTrigger()
            .withIdentity("trigger3", "group1")
            .withSchedule(cronSchedule("0 0/2 8-17 * * ?"))
            .build();*/
       
       //在8-17之间每1分钟执行一次,并且为10秒间隔
       trigger = newTrigger()
       .withIdentity("trigger3", "group1")
       .withSchedule(cronSchedule("0/10 0/1 8-17 * * ?"))
       .build();           
       

       /* job = newJob(SimpleJob.class)
            .withIdentity("job4", "group1")
            .build();
        
        //在16与23之间每3分钟执行一次
        trigger = newTrigger()
            .withIdentity("trigger4", "group1")
            .withSchedule(cronSchedule("0 0/3 16-23 * * ?"))
            .build();*/
        
        /*job = newJob(SimpleJob.class)
            .withIdentity("job5", "group1")
            .build();
        
        trigger = newTrigger()
            .withIdentity("trigger5", "group1")
            .withSchedule(cronSchedule("0 0 10am 1,15 * ?"))
            .build();*/
        
       /* job = newJob(SimpleJob.class)
            .withIdentity("job6", "group1")
            .build();
        
        //2011-07-08 05:11:00,2011-07-08 05:11:02,2011-07-08 05:12:00,2011-07-08 05:12:02
        //第二周到第六周之间执行并且:执行秒数为:0,2各执行一次,没有明白为什么要间隔1分钟后触发,如上.
        trigger = newTrigger()
            .withIdentity("trigger6", "group1")
            .withSchedule(cronSchedule("0,2 * * ? * MON-FRI"))
            .build();*/
/*
        job = newJob(SimpleJob.class)
            .withIdentity("job7", "group1")
            .build();
        
        trigger = newTrigger()
            .withIdentity("trigger7", "group1")
            .withSchedule(cronSchedule("0,30 * * ? * SAT,SUN"))
            .build();*/       
       

        ft = sched.scheduleJob(job, trigger);
        log.info(job.getKey() + " has been scheduled to run at: " + sdf.format(ft)
                + " and repeat based on expression: "
                + trigger.getCronExpression());

        sched.start();

        try {
            //5分钟
            Thread.sleep(300L * 1000L);
          
        } 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();
    }
}


3 SchedEventLister.java
public class SchedEventLister implements Runnable {

	private static Logger _log = LoggerFactory
			.getLogger(SchedEventLister.class);

	private Scheduler sched = null;
	private TriggerKey triggerKey = null;

	public SchedEventLister(TriggerKey triggerKey) {
		_log.info("触发器线程监听启动....");
		this.triggerKey = triggerKey;
		try {
			sched = SchedFacory.getScheduler();
		} catch (SchedulerException e) {
			e.printStackTrace();
		}
	}

	@Override
	public void run() {

		_log.info("触发器线程监听中。。。。"
				+ new SimpleDateFormat("yyyy-MM-dd hh:mm:ss")
						.format(new Date()));

		// 获取当前触发器的状态
		Trigger.TriggerState ts = null;
		try {
			ts = sched.getTriggerState(triggerKey);
		} catch (SchedulerException e) {
			e.printStackTrace();
		}

		// 如果为暂停状态就恢复
		if (ts == Trigger.TriggerState.PAUSED) {
			
			//暂停10秒在恢复
			try {
				_log.warn("暂停当前线程5秒钟后在恢复触发器...,触发器组名: " + triggerKey.getGroup()
						+ ",触发器名称: " + triggerKey.getName());				
				Thread.sleep(5L*1000L);
			} catch (InterruptedException e1) {				
				e1.printStackTrace();
			}
			
			// 恢复触发器
			_log.warn("正在恢复了触发器...,触发器组名: " + triggerKey.getGroup()
					+ ",触发器名称: " + triggerKey.getName());
			try {
				sched.resumeTrigger(triggerKey);
			} catch (SchedulerException e) {
				throw new RuntimeException(e);
			}
			
		} else if (ts == Trigger.TriggerState.NORMAL) {
			_log.info("触发器线程监听中。。。。,状态:正常 ");
		} else if (ts == Trigger.TriggerState.NONE) {
			_log.info("触发器线程监听中。。。。,状态:没有触发器 ");
		} else if (ts == Trigger.TriggerState.ERROR) {
			_log.info("触发器线程监听中。。。。,状态:错误 ");
		} else if (ts == Trigger.TriggerState.BLOCKED) {
			_log.info("触发器线程监听中。。。。,状态:堵塞 ");
		}
	}
}


4 SchedFacory.java
import org.quartz.Scheduler;
import org.quartz.SchedulerException;
import org.quartz.SchedulerFactory;
import org.quartz.impl.StdSchedulerFactory;

/**   
 *Title:     
 *Description:     
 *Copyright: Copyright (c) 2011   
 *Company:http://liuzidong.iteye.com/    
 *Makedate:2011-7-11 上午09:55:36   
 * @author liuzidong   
 * @version 1.0   
 * @since 1.0    
 *   
 */
public class SchedFacory {
	
	private static  SchedulerFactory sf = new StdSchedulerFactory();	
	
	public static Scheduler getScheduler() throws SchedulerException{
		return sf.getScheduler();
	}
}


5 输出结果如下:
[INFO] 2011-07-11 02:54:56.796 下午 main [org.quartz.simpl.SimpleThreadPool]
Job execution threads will use class loader of thread: main

[INFO] 2011-07-11 02:54:56.812 下午 main [org.quartz.core.SchedulerSignalerImpl]
Initialized Scheduler Signaller of type: class org.quartz.core.SchedulerSignalerImpl

[INFO] 2011-07-11 02:54:56.812 下午 main [org.quartz.core.QuartzScheduler]
Quartz Scheduler v.2.0.1 created.

[INFO] 2011-07-11 02:54:56.812 下午 main [org.quartz.simpl.RAMJobStore]
RAMJobStore initialized.

[INFO] 2011-07-11 02:54:56.812 下午 main [org.quartz.core.QuartzScheduler]
Scheduler meta-data: Quartz Scheduler (v2.0.1) '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] 2011-07-11 02:54:56.812 下午 main [org.quartz.impl.StdSchedulerFactory]
Quartz scheduler 'DefaultQuartzScheduler' initialized from default resource file in Quartz package: 'quartz.properties'

[INFO] 2011-07-11 02:54:56.812 下午 main [org.quartz.impl.StdSchedulerFactory]
Quartz scheduler version: 2.0.1

[INFO] 2011-07-11 02:54:56.828 下午 main [org.quartz.examples.example3.CronTriggerExample]
group1.job3 has been scheduled to run at: 2011-07-11 02:55:00 and repeat based on expression: 0/10 0/1 8-17 * * ?

[INFO] 2011-07-11 02:54:56.828 下午 main [org.quartz.core.QuartzScheduler]
Scheduler DefaultQuartzScheduler_$_NON_CLUSTERED started.

[INFO] 2011-07-11 02:55:00.015 下午 DefaultQuartzScheduler_Worker-1 [org.quartz.examples.example3.SchedEventLister]
触发器线程监听启动....

[INFO] 2011-07-11 02:55:00.015 下午 DefaultQuartzScheduler_Worker-1 [org.quartz.examples.example3.SimpleJob]
任务分组名称: group1,任务名称: job3,触发器组名称: group1,触发器名称: trigger3 执行时间: 2011-07-11 02:55:00,计数: 1

[INFO] 2011-07-11 02:55:00.015 下午 Thread-2 [org.quartz.examples.example3.SchedEventLister]
触发器线程监听中。。。。2011-07-11 02:55:00

[INFO] 2011-07-11 02:55:00.015 下午 Thread-2 [org.quartz.examples.example3.SchedEventLister]
触发器线程监听中。。。。,状态:正常 

[INFO] 2011-07-11 02:55:10.000 下午 DefaultQuartzScheduler_Worker-2 [org.quartz.examples.example3.SchedEventLister]
触发器线程监听启动....

[INFO] 2011-07-11 02:55:10.000 下午 DefaultQuartzScheduler_Worker-2 [org.quartz.examples.example3.SimpleJob]
任务分组名称: group1,任务名称: job3,触发器组名称: group1,触发器名称: trigger3 执行时间: 2011-07-11 02:55:10,计数: 2

[INFO] 2011-07-11 02:55:10.000 下午 Thread-3 [org.quartz.examples.example3.SchedEventLister]
触发器线程监听中。。。。2011-07-11 02:55:10

[INFO] 2011-07-11 02:55:10.000 下午 Thread-3 [org.quartz.examples.example3.SchedEventLister]
触发器线程监听中。。。。,状态:正常 

[INFO] 2011-07-11 02:55:20.000 下午 DefaultQuartzScheduler_Worker-3 [org.quartz.examples.example3.SchedEventLister]
触发器线程监听启动....

[INFO] 2011-07-11 02:55:20.000 下午 DefaultQuartzScheduler_Worker-3 [org.quartz.examples.example3.SimpleJob]
任务分组名称: group1,任务名称: job3,触发器组名称: group1,触发器名称: trigger3 执行时间: 2011-07-11 02:55:20,计数: 3

[INFO] 2011-07-11 02:55:20.000 下午 Thread-4 [org.quartz.examples.example3.SchedEventLister]
触发器线程监听中。。。。2011-07-11 02:55:20

[INFO] 2011-07-11 02:55:20.000 下午 Thread-4 [org.quartz.examples.example3.SchedEventLister]
触发器线程监听中。。。。,状态:正常 

[INFO] 2011-07-11 02:55:30.000 下午 DefaultQuartzScheduler_Worker-4 [org.quartz.examples.example3.SchedEventLister]
触发器线程监听启动....

[INFO] 2011-07-11 02:55:30.000 下午 DefaultQuartzScheduler_Worker-4 [org.quartz.examples.example3.SimpleJob]
任务分组名称: group1,任务名称: job3,触发器组名称: group1,触发器名称: trigger3 执行时间: 2011-07-11 02:55:30,计数: 4

[INFO] 2011-07-11 02:55:30.000 下午 Thread-5 [org.quartz.examples.example3.SchedEventLister]
触发器线程监听中。。。。2011-07-11 02:55:30

[INFO] 2011-07-11 02:55:30.000 下午 Thread-5 [org.quartz.examples.example3.SchedEventLister]
触发器线程监听中。。。。,状态:正常 

[INFO] 2011-07-11 02:55:40.000 下午 DefaultQuartzScheduler_Worker-5 [org.quartz.examples.example3.SchedEventLister]
触发器线程监听启动....

[INFO] 2011-07-11 02:55:40.000 下午 DefaultQuartzScheduler_Worker-5 [org.quartz.examples.example3.SimpleJob]
任务分组名称: group1,任务名称: job3,触发器组名称: group1,触发器名称: trigger3 执行时间: 2011-07-11 02:55:40,计数: 5

[INFO] 2011-07-11 02:55:40.000 下午 Thread-6 [org.quartz.examples.example3.SchedEventLister]
触发器线程监听中。。。。2011-07-11 02:55:40

[INFO] 2011-07-11 02:55:40.000 下午 Thread-6 [org.quartz.examples.example3.SchedEventLister]
触发器线程监听中。。。。,状态:正常 

[INFO] 2011-07-11 02:55:50.000 下午 DefaultQuartzScheduler_Worker-6 [org.quartz.examples.example3.SchedEventLister]
触发器线程监听启动....

[INFO] 2011-07-11 02:55:50.000 下午 DefaultQuartzScheduler_Worker-6 [org.quartz.examples.example3.SimpleJob]
任务分组名称: group1,任务名称: job3,触发器组名称: group1,触发器名称: trigger3 执行时间: 2011-07-11 02:55:50,计数: 6

[INFO] 2011-07-11 02:55:50.000 下午 Thread-7 [org.quartz.examples.example3.SchedEventLister]
触发器线程监听中。。。。2011-07-11 02:55:50

[INFO] 2011-07-11 02:55:50.000 下午 Thread-7 [org.quartz.examples.example3.SchedEventLister]
触发器线程监听中。。。。,状态:正常 

[INFO] 2011-07-11 02:56:00.000 下午 DefaultQuartzScheduler_Worker-7 [org.quartz.examples.example3.SchedEventLister]
触发器线程监听启动....

[INFO] 2011-07-11 02:56:00.000 下午 DefaultQuartzScheduler_Worker-7 [org.quartz.examples.example3.SimpleJob]
任务分组名称: group1,任务名称: job3,触发器组名称: group1,触发器名称: trigger3 执行时间: 2011-07-11 02:56:00,计数: 7

[INFO] 2011-07-11 02:56:00.000 下午 Thread-8 [org.quartz.examples.example3.SchedEventLister]
触发器线程监听中。。。。2011-07-11 02:56:00

[INFO] 2011-07-11 02:56:00.000 下午 Thread-8 [org.quartz.examples.example3.SchedEventLister]
触发器线程监听中。。。。,状态:正常 

[INFO] 2011-07-11 02:56:10.000 下午 DefaultQuartzScheduler_Worker-8 [org.quartz.examples.example3.SchedEventLister]
触发器线程监听启动....

[INFO] 2011-07-11 02:56:10.000 下午 DefaultQuartzScheduler_Worker-8 [org.quartz.examples.example3.SimpleJob]
任务分组名称: group1,任务名称: job3,触发器组名称: group1,触发器名称: trigger3 执行时间: 2011-07-11 02:56:10,计数: 8

[INFO] 2011-07-11 02:56:10.000 下午 Thread-9 [org.quartz.examples.example3.SchedEventLister]
触发器线程监听中。。。。2011-07-11 02:56:10

[INFO] 2011-07-11 02:56:10.000 下午 Thread-9 [org.quartz.examples.example3.SchedEventLister]
触发器线程监听中。。。。,状态:正常 

[INFO] 2011-07-11 02:56:20.000 下午 DefaultQuartzScheduler_Worker-9 [org.quartz.examples.example3.SchedEventLister]
触发器线程监听启动....

[INFO] 2011-07-11 02:56:20.000 下午 DefaultQuartzScheduler_Worker-9 [org.quartz.examples.example3.SimpleJob]
任务分组名称: group1,任务名称: job3,触发器组名称: group1,触发器名称: trigger3 执行时间: 2011-07-11 02:56:20,计数: 9

[INFO] 2011-07-11 02:56:20.000 下午 Thread-10 [org.quartz.examples.example3.SchedEventLister]
触发器线程监听中。。。。2011-07-11 02:56:20

[INFO] 2011-07-11 02:56:20.000 下午 Thread-10 [org.quartz.examples.example3.SchedEventLister]
触发器线程监听中。。。。,状态:正常 

[INFO] 2011-07-11 02:56:30.000 下午 DefaultQuartzScheduler_Worker-10 [org.quartz.examples.example3.SchedEventLister]
触发器线程监听启动....

[INFO] 2011-07-11 02:56:30.000 下午 DefaultQuartzScheduler_Worker-10 [org.quartz.examples.example3.SimpleJob]
任务分组名称: group1,任务名称: job3,触发器组名称: group1,触发器名称: trigger3 执行时间: 2011-07-11 02:56:30,计数: 10

[INFO] 2011-07-11 02:56:30.000 下午 Thread-11 [org.quartz.examples.example3.SchedEventLister]
触发器线程监听中。。。。2011-07-11 02:56:30

[INFO] 2011-07-11 02:56:30.000 下午 Thread-11 [org.quartz.examples.example3.SchedEventLister]
触发器线程监听中。。。。,状态:正常 

[INFO] 2011-07-11 02:56:40.000 下午 DefaultQuartzScheduler_Worker-1 [org.quartz.examples.example3.SchedEventLister]
触发器线程监听启动....

[INFO] 2011-07-11 02:56:40.000 下午 DefaultQuartzScheduler_Worker-1 [org.quartz.examples.example3.SimpleJob]
任务分组名称: group1,任务名称: job3,触发器组名称: group1,触发器名称: trigger3 执行时间: 2011-07-11 02:56:40,计数: 11

[INFO] 2011-07-11 02:56:40.000 下午 Thread-12 [org.quartz.examples.example3.SchedEventLister]
触发器线程监听中。。。。2011-07-11 02:56:40

[INFO] 2011-07-11 02:56:40.000 下午 Thread-12 [org.quartz.examples.example3.SchedEventLister]
触发器线程监听中。。。。,状态:正常 

[INFO] 2011-07-11 02:56:50.000 下午 DefaultQuartzScheduler_Worker-2 [org.quartz.examples.example3.SchedEventLister]
触发器线程监听启动....

[INFO] 2011-07-11 02:56:50.000 下午 DefaultQuartzScheduler_Worker-2 [org.quartz.examples.example3.SimpleJob]
任务分组名称: group1,任务名称: job3,触发器组名称: group1,触发器名称: trigger3 执行时间: 2011-07-11 02:56:50,计数: 12

[INFO] 2011-07-11 02:56:50.000 下午 Thread-13 [org.quartz.examples.example3.SchedEventLister]
触发器线程监听中。。。。2011-07-11 02:56:50

[INFO] 2011-07-11 02:56:50.000 下午 Thread-13 [org.quartz.examples.example3.SchedEventLister]
触发器线程监听中。。。。,状态:正常 

[INFO] 2011-07-11 02:57:00.000 下午 DefaultQuartzScheduler_Worker-3 [org.quartz.examples.example3.SchedEventLister]
触发器线程监听启动....

[INFO] 2011-07-11 02:57:00.000 下午 DefaultQuartzScheduler_Worker-3 [org.quartz.examples.example3.SimpleJob]
任务分组名称: group1,任务名称: job3,触发器组名称: group1,触发器名称: trigger3 执行时间: 2011-07-11 02:57:00,计数: 13

[INFO] 2011-07-11 02:57:00.000 下午 Thread-14 [org.quartz.examples.example3.SchedEventLister]
触发器线程监听中。。。。2011-07-11 02:57:00

[INFO] 2011-07-11 02:57:00.000 下午 Thread-14 [org.quartz.examples.example3.SchedEventLister]
触发器线程监听中。。。。,状态:正常 

[INFO] 2011-07-11 02:57:10.000 下午 DefaultQuartzScheduler_Worker-4 [org.quartz.examples.example3.SchedEventLister]
触发器线程监听启动....

[INFO] 2011-07-11 02:57:10.000 下午 DefaultQuartzScheduler_Worker-4 [org.quartz.examples.example3.SimpleJob]
任务分组名称: group1,任务名称: job3,触发器组名称: group1,触发器名称: trigger3 执行时间: 2011-07-11 02:57:10,计数: 14

[INFO] 2011-07-11 02:57:10.000 下午 Thread-15 [org.quartz.examples.example3.SchedEventLister]
触发器线程监听中。。。。2011-07-11 02:57:10

[INFO] 2011-07-11 02:57:10.000 下午 Thread-15 [org.quartz.examples.example3.SchedEventLister]
触发器线程监听中。。。。,状态:正常 

[INFO] 2011-07-11 02:57:20.000 下午 DefaultQuartzScheduler_Worker-5 [org.quartz.examples.example3.SchedEventLister]
触发器线程监听启动....

[INFO] 2011-07-11 02:57:20.000 下午 DefaultQuartzScheduler_Worker-5 [org.quartz.examples.example3.SimpleJob]
任务分组名称: group1,任务名称: job3,触发器组名称: group1,触发器名称: trigger3 执行时间: 2011-07-11 02:57:20,计数: 15

[WARN] 2011-07-11 02:57:20.000 下午 DefaultQuartzScheduler_Worker-5 [org.quartz.examples.example3.SimpleJob]
已经暂停了触发器...,触发器组名: group1,触发器名称: trigger3

[INFO] 2011-07-11 02:57:20.000 下午 Thread-16 [org.quartz.examples.example3.SchedEventLister]
触发器线程监听中。。。。2011-07-11 02:57:20

[WARN] 2011-07-11 02:57:20.000 下午 Thread-16 [org.quartz.examples.example3.SchedEventLister]
暂停当前线程5秒钟后在恢复触发器...,触发器组名: group1,触发器名称: trigger3

[WARN] 2011-07-11 02:57:25.000 下午 Thread-16 [org.quartz.examples.example3.SchedEventLister]
正在恢复了触发器...,触发器组名: group1,触发器名称: trigger3

[INFO] 2011-07-11 02:57:30.015 下午 DefaultQuartzScheduler_Worker-6 [org.quartz.examples.example3.SchedEventLister]
触发器线程监听启动....

[INFO] 2011-07-11 02:57:30.031 下午 DefaultQuartzScheduler_Worker-6 [org.quartz.examples.example3.SimpleJob]
任务分组名称: group1,任务名称: job3,触发器组名称: group1,触发器名称: trigger3 执行时间: 2011-07-11 02:57:30,计数: 16

[INFO] 2011-07-11 02:57:30.031 下午 Thread-17 [org.quartz.examples.example3.SchedEventLister]
触发器线程监听中。。。。2011-07-11 02:57:30

[INFO] 2011-07-11 02:57:30.031 下午 Thread-17 [org.quartz.examples.example3.SchedEventLister]
触发器线程监听中。。。。,状态:正常 

[INFO] 2011-07-11 02:57:40.000 下午 DefaultQuartzScheduler_Worker-7 [org.quartz.examples.example3.SchedEventLister]
触发器线程监听启动....

[INFO] 2011-07-11 02:57:40.000 下午 DefaultQuartzScheduler_Worker-7 [org.quartz.examples.example3.SimpleJob]
任务分组名称: group1,任务名称: job3,触发器组名称: group1,触发器名称: trigger3 执行时间: 2011-07-11 02:57:40,计数: 17

[INFO] 2011-07-11 02:57:40.000 下午 Thread-18 [org.quartz.examples.example3.SchedEventLister]
触发器线程监听中。。。。2011-07-11 02:57:40

[INFO] 2011-07-11 02:57:40.000 下午 Thread-18 [org.quartz.examples.example3.SchedEventLister]
触发器线程监听中。。。。,状态:正常 

[INFO] 2011-07-11 02:57:50.000 下午 DefaultQuartzScheduler_Worker-8 [org.quartz.examples.example3.SchedEventLister]
触发器线程监听启动....

[INFO] 2011-07-11 02:57:50.000 下午 DefaultQuartzScheduler_Worker-8 [org.quartz.examples.example3.SimpleJob]
任务分组名称: group1,任务名称: job3,触发器组名称: group1,触发器名称: trigger3 执行时间: 2011-07-11 02:57:50,计数: 18

[INFO] 2011-07-11 02:57:50.000 下午 Thread-19 [org.quartz.examples.example3.SchedEventLister]
触发器线程监听中。。。。2011-07-11 02:57:50

[INFO] 2011-07-11 02:57:50.000 下午 Thread-19 [org.quartz.examples.example3.SchedEventLister]
触发器线程监听中。。。。,状态:正常 

[INFO] 2011-07-11 02:58:00.000 下午 DefaultQuartzScheduler_Worker-9 [org.quartz.examples.example3.SchedEventLister]
触发器线程监听启动....

[INFO] 2011-07-11 02:58:00.000 下午 DefaultQuartzScheduler_Worker-9 [org.quartz.examples.example3.SimpleJob]
任务分组名称: group1,任务名称: job3,触发器组名称: group1,触发器名称: trigger3 执行时间: 2011-07-11 02:58:00,计数: 19

[INFO] 2011-07-11 02:58:00.000 下午 Thread-20 [org.quartz.examples.example3.SchedEventLister]
触发器线程监听中。。。。2011-07-11 02:58:00

[INFO] 2011-07-11 02:58:00.000 下午 Thread-20 [org.quartz.examples.example3.SchedEventLister]
触发器线程监听中。。。。,状态:正常 

[INFO] 2011-07-11 02:58:10.000 下午 DefaultQuartzScheduler_Worker-10 [org.quartz.examples.example3.SchedEventLister]
触发器线程监听启动....

[INFO] 2011-07-11 02:58:10.000 下午 DefaultQuartzScheduler_Worker-10 [org.quartz.examples.example3.SimpleJob]
任务分组名称: group1,任务名称: job3,触发器组名称: group1,触发器名称: trigger3 执行时间: 2011-07-11 02:58:10,计数: 20

[INFO] 2011-07-11 02:58:10.000 下午 Thread-21 [org.quartz.examples.example3.SchedEventLister]
触发器线程监听中。。。。2011-07-11 02:58:10

[ERROR] 2011-07-11 02:58:10.000 下午 DefaultQuartzScheduler_Worker-10 [org.quartz.examples.example3.SimpleJob]
正在停止并且移除触发器...,触发器组名: group1,触发器名称: trigger3

[INFO] 2011-07-11 02:58:10.000 下午 Thread-21 [org.quartz.examples.example3.SchedEventLister]
触发器线程监听中。。。。,状态:正常 

[INFO] 2011-07-11 02:59:56.828 下午 main [org.quartz.examples.example3.CronTriggerExample]
------- Shutting Down ---------------------

[INFO] 2011-07-11 02:59:56.828 下午 main [org.quartz.core.QuartzScheduler]
Scheduler DefaultQuartzScheduler_$_NON_CLUSTERED shutting down.

[INFO] 2011-07-11 02:59:56.828 下午 main [org.quartz.core.QuartzScheduler]
Scheduler DefaultQuartzScheduler_$_NON_CLUSTERED paused.

[INFO] 2011-07-11 02:59:56.828 下午 main [org.quartz.core.QuartzScheduler]
Scheduler DefaultQuartzScheduler_$_NON_CLUSTERED shutdown complete.

[INFO] 2011-07-11 02:59:56.828 下午 main [org.quartz.examples.example3.CronTriggerExample]
------- Shutdown Complete -----------------

[INFO] 2011-07-11 02:59:56.828 下午 main [org.quartz.examples.example3.CronTriggerExample]
Executed 20 jobs.

你可能感兴趣的:(java,quartz)