/** * @return whether the associated Job class carries the {@link PersistJobDataAfterExecution} annotation. */ public boolean isPersistJobDataAfterExecution() { return ClassUtils.isAnnotationPresent(jobClass, PersistJobDataAfterExecution.class); }
public static boolean isAnnotationPresent(Class<?> clazz, Class<? extends Annotation> a) { for (Class<?> c = clazz; c != null; c = c.getSuperclass()) { if (c.isAnnotationPresent(a)) return true; if(isAnnotationPresentOnInterfaces(c, a)) return true; } return false; }
/** * <p> * Called by the <class>{@link org.quartz.core.QuartzSchedulerThread} * </code> to obtain instances of <code> * {@link org.quartz.core.JobRunShell}</code>. * </p> */ public JobRunShell createJobRunShell(TriggerFiredBundle bundle) throws SchedulerException { ExecuteInJTATransaction jtaAnnotation = ClassUtils.getAnnotation(bundle.getJobDetail().getJobClass(), ExecuteInJTATransaction.class); if(jtaAnnotation == null) return new JobRunShell(scheduler, bundle); else { int timeout = jtaAnnotation.timeout(); if (timeout >= 0) { return new JTAJobRunShell(scheduler, bundle, timeout); } else { return new JTAJobRunShell(scheduler, bundle); } } }
/** * <p> * Called by the <class>{@link org.quartz.core.QuartzSchedulerThread} * </code> to obtain instances of <code> * {@link org.quartz.core.JobRunShell}</code>. * </p> */ public JobRunShell createJobRunShell(TriggerFiredBundle bundle) throws SchedulerException { ExecuteInJTATransaction jtaAnnotation = ClassUtils.getAnnotation(bundle.getJobDetail().getJobClass(), ExecuteInJTATransaction.class); if(jtaAnnotation == null) return new JobRunShell(scheduler, bundle); else { int timeout = jtaAnnotation.timeout(); if (timeout >= 0) { return new JTAJobRunShell(scheduler, bundle, timeout); } else { return new JTAJobRunShell(scheduler, bundle); } } }
/** * @return whether the associated Job class carries the {@link DisallowConcurrentExecution} annotation. */ public boolean isConcurrentExectionDisallowed() { return ClassUtils.isAnnotationPresent(jobClass, DisallowConcurrentExecution.class); }
public static boolean isAnnotationPresent(Class<?> clazz, Class<? extends Annotation> a) { for (Class<?> c = clazz; c != null; c = c.getSuperclass()) { if (c.isAnnotationPresent(a)) return true; if(isAnnotationPresentOnInterfaces(c, a)) return true; } return false; }
/** * @return whether the associated Job class carries the {@link DisallowConcurrentExecution} annotation. */ public boolean isConcurrentExectionDisallowed() { return ClassUtils.isAnnotationPresent(jobClass, DisallowConcurrentExecution.class); }
private static boolean isAnnotationPresentOnInterfaces(Class<?> clazz, Class<? extends Annotation> a) { for(Class<?> i : clazz.getInterfaces()) { if( i.isAnnotationPresent(a) ) return true; if(isAnnotationPresentOnInterfaces(i, a)) return true; } return false; }
/** * @return whether the associated Job class carries the {@link PersistJobDataAfterExecution} annotation. */ public boolean isPersistJobDataAfterExecution() { return ClassUtils.isAnnotationPresent(jobClass, PersistJobDataAfterExecution.class); }
private static boolean isAnnotationPresentOnInterfaces(Class<?> clazz, Class<? extends Annotation> a) { for(Class<?> i : clazz.getInterfaces()) { if( i.isAnnotationPresent(a) ) return true; if(isAnnotationPresentOnInterfaces(i, a)) return true; } return false; }
@SuppressWarnings("unchecked") private boolean isPersistJobDataAfterExecution(String jobClassName) { boolean persistJobDataAfterExecution = false; try { Class<Job> jobClass = (Class<Job>) loadHelper.getClassLoader().loadClass(jobClassName); persistJobDataAfterExecution = ClassUtils.isAnnotationPresent(jobClass, PersistJobDataAfterExecution.class); } catch (Exception ex) { log.error("could not determine whether class: " + jobClassName + " is PersistJobDataAfterExecution annotated"); } return persistJobDataAfterExecution; }
@SuppressWarnings("unchecked") private boolean isJobConcurrentExectionDisallowed(String jobClassName) { boolean jobConcurrentExectionDisallowed = false; try { Class<Job> jobClass = (Class<Job>) loadHelper.getClassLoader().loadClass(jobClassName); jobConcurrentExectionDisallowed = ClassUtils.isAnnotationPresent(jobClass, DisallowConcurrentExecution.class); } catch (Exception ex) { log.error("could not determine whether class: " + jobClassName + " is JobConcurrentExectionDisallowed annotated"); } return jobConcurrentExectionDisallowed; }