public class SimpleManagedJobScheduler extends Object implements io.dropwizard.lifecycle.Managed
com.fiestacabin.dropwizard.quartz.ManagedScheduler used to setup time base running jobs.
The difference (and advantage) to ManagedScheduler is here that the job class does not need the @Scheduled annotation and
can be configured by standard dropwizard configuration mechanism.
Usage:
// register SimpleManagedJobScheduler scheduler to start/stop with the jetty server
environment.lifecycle().manage(injector.getInstance(SimpleManagedJobScheduler.class));
// add job class
injector.getInstance(SimpleManagedJobScheduler.class).addJob(MyJob.class,
config.getJobsConfiguration().getIntervallMillis());
| Constructor and Description |
|---|
SimpleManagedJobScheduler(org.quartz.Scheduler scheduler,
LxGuiceJobFactory jobFactory) |
| Modifier and Type | Method and Description |
|---|---|
void |
addJob(Class<? extends org.quartz.Job> jobClass,
long intervalInMilliseconds)
Add a job that is executed each n milliseconds.
|
static SimpleManagedJobScheduler |
getInstance() |
org.quartz.Scheduler |
getScheduler() |
void |
start() |
void |
stop() |
@Inject
public SimpleManagedJobScheduler(org.quartz.Scheduler scheduler,
LxGuiceJobFactory jobFactory)
throws org.quartz.SchedulerException
org.quartz.SchedulerExceptionpublic static SimpleManagedJobScheduler getInstance() throws org.quartz.SchedulerException
org.quartz.SchedulerExceptionpublic void addJob(Class<? extends org.quartz.Job> jobClass, long intervalInMilliseconds) throws org.quartz.SchedulerException
jobClass - intervalInMilliseconds - org.quartz.SchedulerExceptionpublic org.quartz.Scheduler getScheduler()
public void start()
throws Exception
start in interface io.dropwizard.lifecycle.ManagedExceptionCopyright © 2020 LeanIX GmbH. All rights reserved.