Skip to content

Commit 3241a00

Browse files
committed
fix(scheduler): make scheduled job list multimaps syncrhonized
1 parent 1024743 commit 3241a00

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

src/main/java/com/conveyal/datatools/common/utils/Scheduler.java

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@
2626
import java.util.concurrent.TimeUnit;
2727

2828
import static com.conveyal.datatools.common.utils.Utils.getTimezone;
29+
import static com.google.common.collect.Multimaps.synchronizedListMultimap;
2930

3031
/**
3132
* This class centralizes the logic associated with scheduling and cancelling tasks (organized as a {@link ScheduledJob})
@@ -41,9 +42,11 @@ public class Scheduler {
4142
// Scheduled executor that handles running scheduled jobs.
4243
public final static ScheduledExecutorService schedulerService = Executors.newScheduledThreadPool(1);
4344
/** Stores {@link ScheduledJob} objects containing scheduled tasks keyed on the tasks's associated {@link FeedSource} ID. */
44-
public final static ListMultimap<String, ScheduledJob> scheduledJobsForFeedSources = ArrayListMultimap.create();
45+
public final static ListMultimap<String, ScheduledJob> scheduledJobsForFeedSources =
46+
synchronizedListMultimap(ArrayListMultimap.create());
4547
/** Stores {@link ScheduledJob} objects containing scheduled tasks keyed on the tasks's associated {@link Project} ID. */
46-
public final static ListMultimap<String, ScheduledJob> scheduledJobsForProjects = ArrayListMultimap.create();
48+
public final static ListMultimap<String, ScheduledJob> scheduledJobsForProjects =
49+
synchronizedListMultimap(ArrayListMultimap.create());
4750

4851
/**
4952
* A method to initialize all scheduled tasks upon server startup.

0 commit comments

Comments
 (0)