Example usage for org.springframework.scheduling.quartz MethodInvokingJobDetailFactoryBean setConcurrent

List of usage examples for org.springframework.scheduling.quartz MethodInvokingJobDetailFactoryBean setConcurrent

Introduction

In this page you can find the example usage for org.springframework.scheduling.quartz MethodInvokingJobDetailFactoryBean setConcurrent.

Prototype

public void setConcurrent(boolean concurrent) 

Source Link

Document

Specify whether or not multiple jobs should be run in a concurrent fashion.

Usage

From source file:com.linuxbox.enkive.statistics.consolidation.ConsolidationRunner.java

@PostConstruct
public void init() throws Exception {
    // create factory
    MethodInvokingJobDetailFactoryBean jobDetail = new MethodInvokingJobDetailFactoryBean();
    jobDetail.setTargetObject(this);
    jobDetail.setName("ConsolidationRunnerJob");
    jobDetail.setTargetMethod("run");
    jobDetail.setConcurrent(false);
    jobDetail.afterPropertiesSet();// w  ww . ja va 2  s .  co m

    // create trigger
    CronTriggerBean trigger = new CronTriggerBean();
    trigger.setBeanName("ConsolidationRunnerTrigger");
    trigger.setJobDetail((JobDetail) jobDetail.getObject());
    trigger.setCronExpression(schedule);
    trigger.afterPropertiesSet();

    // add to schedule defined in spring xml
    scheduler.scheduleJob((JobDetail) jobDetail.getObject(), trigger);
}

From source file:org.apache.fineract.infrastructure.jobs.service.JobRegisterServiceImpl.java

private JobDetail createJobDetail(final ScheduledJobDetail scheduledJobDetail) throws Exception {
    final FineractPlatformTenant tenant = ThreadLocalContextUtil.getTenant();
    final ClassMethodNamesPair jobDetails = CronMethodParser
            .findTargetMethodDetails(scheduledJobDetail.getJobName());
    if (jobDetails == null) {
        throw new IllegalArgumentException(
                "Code has no @CronTarget with this job name (@see JobName); seems like DB/code are not in line: "
                        + scheduledJobDetail.getJobName());
    }/* ww w .  j  a v  a2  s .  c om*/
    final Object targetObject = getBeanObject(Class.forName(jobDetails.className));
    final MethodInvokingJobDetailFactoryBean jobDetailFactoryBean = new MethodInvokingJobDetailFactoryBean();
    jobDetailFactoryBean.setName(scheduledJobDetail.getJobName() + "JobDetail" + tenant.getId());
    jobDetailFactoryBean.setTargetObject(targetObject);
    jobDetailFactoryBean.setTargetMethod(jobDetails.methodName);
    jobDetailFactoryBean.setGroup(scheduledJobDetail.getGroupName());
    jobDetailFactoryBean.setConcurrent(false);
    jobDetailFactoryBean.afterPropertiesSet();
    return jobDetailFactoryBean.getObject();
}

From source file:org.mifosplatform.infrastructure.jobs.service.JobRegisterServiceImpl.java

private JobDetail createJobDetail(final ScheduledJobDetail scheduledJobDetail) throws Exception {
    final MifosPlatformTenant tenant = ThreadLocalContextUtil.getTenant();
    final ClassMethodNamesPair jobDetails = CronMethodParser
            .findTargetMethodDetails(scheduledJobDetail.getJobName());
    if (jobDetails == null) {
        throw new IllegalArgumentException(
                "Code has no @CronTarget with this job name (@see JobName); seems like DB/code are not in line: "
                        + scheduledJobDetail.getJobName());
    }/*from   w w w  .j  a v  a2s.  c o m*/
    final Object targetObject = getBeanObject(Class.forName(jobDetails.className));
    final MethodInvokingJobDetailFactoryBean jobDetailFactoryBean = new MethodInvokingJobDetailFactoryBean();
    jobDetailFactoryBean.setName(scheduledJobDetail.getJobName() + "JobDetail" + tenant.getId());
    jobDetailFactoryBean.setTargetObject(targetObject);
    jobDetailFactoryBean.setTargetMethod(jobDetails.methodName);
    jobDetailFactoryBean.setGroup(scheduledJobDetail.getGroupName());
    jobDetailFactoryBean.setConcurrent(false);
    jobDetailFactoryBean.afterPropertiesSet();
    return jobDetailFactoryBean.getObject();
}