All Downloads are FREE. Search and download functionalities are using the official Maven repository.

net.leanix.dropkit.quartz.LxGuiceJobFactory Maven / Gradle / Ivy

There is a newer version: 2.0.10
Show newest version
package net.leanix.dropkit.quartz;

import javax.inject.Inject;

import org.quartz.Job;
import org.quartz.JobDetail;
import org.quartz.Scheduler;
import org.quartz.SchedulerException;
import org.quartz.spi.JobFactory;
import org.quartz.spi.TriggerFiredBundle;

import com.google.inject.Injector;

public class LxGuiceJobFactory implements JobFactory {

    private final Injector injector;

    @Inject
    public LxGuiceJobFactory(Injector injector) {
        this.injector = injector;
    }

    @Override
    public Job newJob(TriggerFiredBundle bundle, Scheduler scheduler)
            throws SchedulerException {

        JobDetail jobDetail = bundle.getJobDetail();
        Class jobClass = jobDetail.getJobClass();
        return injector.getInstance(jobClass);
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy