1 16 17 package org.springframework.scheduling.quartz; 18 19 import org.quartz.Job; 20 import org.quartz.JobExecutionContext; 21 import org.quartz.JobExecutionException; 22 23 import org.springframework.util.Assert; 24 25 38 public class DelegatingJob implements Job { 39 40 private final Runnable delegate; 41 42 43 47 public DelegatingJob(Runnable delegate) { 48 Assert.notNull(delegate, "Delegate must not be null"); 49 this.delegate = delegate; 50 } 51 52 55 public final Runnable getDelegate() { 56 return this.delegate; 57 } 58 59 60 65 public void execute(JobExecutionContext context) throws JobExecutionException { 66 try { 67 this.delegate.run(); 68 } 69 catch (Exception ex) { 70 throw new JobExecutionException(ex); 71 } 72 } 73 74 } 75 | Popular Tags |