赞
踩
@Component @DisallowConcurrentExecution @CronExp(id = 2,cron = "0/30 * * * * ?") public class TestJob implements Job { @SaIgnore @Override public void execute(JobExecutionContext context) throws JobExecutionException { try { String[] str = {"1223",null,"212","333"}; for (String s : str) { s.equals("sss");//模拟空指针异常 } } catch (Exception e) { e.printStackTrace(); JobExecutionException e2 = new JobExecutionException(e); e2.setRefireImmediately(true);//重新执行 try { Thread.sleep(2000); System.out.println(LocalDateTime.now()+" **********"); } catch (InterruptedException ex) { ex.printStackTrace(); } throw e2; } System.out.println("定时任务2执行了******"); } }
<!--Quartz定时依赖--> <dependency> <groupId>xin.altitude.cms</groupId> <artifactId>ucode-cms-quartz</artifactId> <version>1.5.3.1</version> </dependency>
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。