Example usage for org.springframework.scheduling.quartz DelegatingJob DelegatingJob

List of usage examples for org.springframework.scheduling.quartz DelegatingJob DelegatingJob

Introduction

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

Prototype

public DelegatingJob(Runnable delegate) 

Source Link

Document

Create a new DelegatingJob.

Usage

From source file:org.openvpms.component.business.service.scheduler.JobRunner.java

/**
 * Creates the job.//from w w  w.ja  va  2 s  .co m
 *
 * @return a new job
 * @throws ClassNotFoundException if the job class cannot be found
 */
private Job createJob() throws ClassNotFoundException {
    Job result;
    IMObjectBean bean = new IMObjectBean(configuration, service);
    Class type = Class.forName(bean.getString("class"));
    DefaultListableBeanFactory factory = new DefaultListableBeanFactory(context);
    factory.registerSingleton("jobConfiguration", configuration);
    Object job = factory.createBean(type, AutowireCapableBeanFactory.AUTOWIRE_CONSTRUCTOR, true);
    if (job instanceof Runnable) {
        result = new DelegatingJob((Runnable) job);
    } else {
        result = (Job) job;
    }
    return result;
}