Skip to content

Commit 10721a1

Browse files
author
Harry Chan
committed
Quartz - Accept list in constructor
Quartz module - accept list in constructor to avoid copying list to a new array.
1 parent 1a00281 commit 10721a1

1 file changed

Lines changed: 21 additions & 0 deletions

File tree

modules/jooby-quartz/src/main/java/io/jooby/quartz/QuartzModule.java

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -109,6 +109,15 @@ public QuartzModule(final Class<?>... jobs) {
109109
this.jobs = Arrays.asList(jobs);
110110
}
111111

112+
/**
113+
* Creates Quartz module and register the given jobs.
114+
*
115+
* @param jobs Job classes.
116+
*/
117+
public QuartzModule(final List<Class<?>> jobs) {
118+
this.jobs = jobs;
119+
}
120+
112121
/**
113122
* Creates Quartz module and register the given jobs. Uses an user provided schedule, schedule
114123
* is started at application start up time and shutdown on application shutdown.
@@ -121,6 +130,18 @@ public QuartzModule(@Nonnull Scheduler scheduler, final Class<?>... jobs) {
121130
this.jobs = Arrays.asList(jobs);
122131
}
123132

133+
/**
134+
* Creates Quartz module and register the given jobs. Uses an user provided schedule, schedule
135+
* is started at application start up time and shutdown on application shutdown.
136+
*
137+
* @param scheduler Provided scheduler.
138+
* @param jobs Job classes.
139+
*/
140+
public QuartzModule(@Nonnull Scheduler scheduler, final List<Class<?>> jobs) {
141+
this.scheduler = scheduler;
142+
this.jobs = jobs;
143+
}
144+
124145
@Override public void install(@Nonnull Jooby application) throws Exception {
125146
Config config = application.getConfig();
126147
Map<JobDetail, Trigger> jobMap = JobGenerator.build(application, jobs);

0 commit comments

Comments
 (0)