Java Code Examples for org.springframework.scheduling.quartz.MethodInvokingJobDetailFactoryBean#setTargetClass()

The following examples show how to use org.springframework.scheduling.quartz.MethodInvokingJobDetailFactoryBean#setTargetClass() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: JobAdder.java    From quartz-glass with Apache License 2.0 6 votes vote down vote up
private JobDetail methodExecuteJobDetail(Class<?> clazz, JobKey jobKey, JobDataMap jobDataMapping) throws Exception {
    MethodInvokingJobDetailFactoryBean factoryBean = new MethodInvokingJobDetailFactoryBean();
    factoryBean.setGroup(jobKey.getGroup());
    factoryBean.setName(jobKey.getName());

    factoryBean.setTargetClass(clazz);
    factoryBean.setTargetMethod(findExecuteMethod(clazz));
    boolean allowConcurrent = !clazz.isAnnotationPresent(DisallowConcurrentExecution.class);
    factoryBean.setConcurrent(allowConcurrent);

    factoryBean.afterPropertiesSet();

    JobDetail jobDetail = factoryBean.getObject();
    JobDataMap jobDataMap = jobDetail.getJobDataMap();
    jobDataMap.putAll(jobDataMapping);
    jobDataMap.remove("methodInvoker");

    PojoJobMeta pojoJobMeta = createPojoJobMeta(clazz, jobKey, jobDataMapping);
    jobDataMap.put(GlassConstants.POJO_JOB_META, pojoJobMeta);

    return jobDetail;
}
 
Example 2
Source File: GlassJobFactory.java    From quartz-glass with Apache License 2.0 5 votes vote down vote up
private MethodInvokingJobDetailFactoryBean createMethodInvoker(PojoJobMeta pojoJobMeta) throws Exception {
    MethodInvokingJobDetailFactoryBean factoryBean = new MethodInvokingJobDetailFactoryBean();
    factoryBean.setGroup(pojoJobMeta.getGroup());
    factoryBean.setName(pojoJobMeta.getName());

    factoryBean.setTargetClass(pojoJobMeta.getTargetClass());
    factoryBean.setTargetMethod(pojoJobMeta.getTargetMethod());
    factoryBean.setConcurrent(pojoJobMeta.isConcurrent());

    factoryBean.afterPropertiesSet();


    return factoryBean;
}