net.leanix.dropkit.quartz.LxGuiceJobFactory Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of leanix-dropkit Show documentation
Show all versions of leanix-dropkit Show documentation
Base functionality for leanIX dropwizard-based services
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 extends Job> jobClass = jobDetail.getJobClass();
return injector.getInstance(jobClass);
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy