1 17 18 package org.quartz.examples.example11; 19 20 import java.util.Date ; 21 22 import org.apache.commons.logging.Log; 23 import org.apache.commons.logging.LogFactory; 24 import org.quartz.Job; 25 import org.quartz.JobExecutionContext; 26 import org.quartz.JobExecutionException; 27 28 35 public class SimpleJob implements Job { 36 37 private static Log _log = LogFactory.getLog(SimpleJob.class); 38 39 public static final String DELAY_TIME = "delay time"; 41 42 45 public SimpleJob() { 46 } 47 48 58 public void execute(JobExecutionContext context) 59 throws JobExecutionException { 60 61 String jobName = context.getJobDetail().getFullName(); 64 _log.info("Executing job: " + jobName + " executing at " + new Date ()); 65 66 long delayTime = 68 context.getJobDetail().getJobDataMap().getLong(DELAY_TIME); 69 try { 70 Thread.sleep(delayTime); 71 } catch (Exception e) { 72 } 73 74 _log.info("Finished Executing job: " + jobName + " at " + new Date ()); 75 } 76 77 } | Popular Tags |