1 17 18 package org.quartz.examples.example6; 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.StatefulJob; 25 import org.quartz.JobExecutionContext; 26 import org.quartz.JobExecutionException; 27 28 35 public class BadJob2 implements StatefulJob { 36 37 private static Log _log = LogFactory.getLog(BadJob2.class); 39 40 43 public BadJob2() { 44 } 45 46 55 public void execute(JobExecutionContext context) 56 throws JobExecutionException { 57 String jobName = context.getJobDetail().getFullName(); 58 _log.info("---" + jobName + " executing at " + new Date ()); 59 60 try { 64 int zero = 0; 65 int calculation = 4815 / zero; 66 } catch (Exception e) { 67 _log.info("--- Error in job!"); 68 JobExecutionException e2 = 69 new JobExecutionException(e); 70 e2.setUnscheduleAllTriggers(true); 74 throw e2; 75 } 76 77 _log.info("---" + jobName + " completed at " + new Date ()); 78 } 79 80 } | Popular Tags |