1 17 18 package org.quartz.examples.example10; 19 20 import org.apache.commons.logging.Log; 21 import org.apache.commons.logging.LogFactory; 22 import org.quartz.Scheduler; 23 import org.quartz.SchedulerFactory; 24 import org.quartz.SchedulerMetaData; 25 import org.quartz.impl.StdSchedulerFactory; 26 27 32 public class PlugInExample { 33 34 public void run() throws Exception { 35 Log log = LogFactory.getLog(PlugInExample.class); 36 37 SchedulerFactory sf = new StdSchedulerFactory(); 39 Scheduler sched = sf.getScheduler(); 40 41 log.info("------- Initialization Complete -----------"); 42 43 log.info("------- (Not Scheduling any Jobs - relying on XML definitions --"); 44 45 log.info("------- Starting Scheduler ----------------"); 46 47 sched.start(); 49 50 log.info("------- Started Scheduler -----------------"); 51 52 log.info("------- Waiting five minutes... -----------"); 53 54 try { 56 Thread.sleep(300L * 1000L); 57 } catch (Exception e) { 58 } 59 60 log.info("------- Shutting Down ---------------------"); 62 sched.shutdown(true); 63 log.info("------- Shutdown Complete -----------------"); 64 65 SchedulerMetaData metaData = sched.getMetaData(); 66 log.info("Executed " + metaData.numJobsExecuted() + " jobs."); 67 } 68 69 public static void main(String [] args) throws Exception { 70 71 PlugInExample example = new PlugInExample(); 72 example.run(); 73 } 74 75 } | Popular Tags |