From bacb1e55207c90c3487955c26a716dbf8ad78141 Mon Sep 17 00:00:00 2001 From: Fangjin Yang Date: Fri, 12 Apr 2013 22:12:22 -0700 Subject: [PATCH] update fix --- .../druid/merger/common/task/RealtimeIndexTask.java | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/merger/src/main/java/com/metamx/druid/merger/common/task/RealtimeIndexTask.java b/merger/src/main/java/com/metamx/druid/merger/common/task/RealtimeIndexTask.java index 65bad47c1bc..fb13d7d6fb9 100644 --- a/merger/src/main/java/com/metamx/druid/merger/common/task/RealtimeIndexTask.java +++ b/merger/src/main/java/com/metamx/druid/merger/common/task/RealtimeIndexTask.java @@ -118,12 +118,6 @@ public class RealtimeIndexTask extends AbstractTask @Override public TaskStatus run(final TaskToolbox toolbox) throws Exception { - synchronized (lock) { - if (shutdown) { - return TaskStatus.success(getId()); - } - } - if (this.plumber != null) { throw new IllegalStateException("WTF?!? run with non-null plumber??!"); } @@ -139,7 +133,12 @@ public class RealtimeIndexTask extends AbstractTask final FireDepartmentMetrics metrics = new FireDepartmentMetrics(); final Period intermediatePersistPeriod = fireDepartmentConfig.getIntermediatePersistPeriod(); - firehose = new GracefulShutdownFirehose(firehoseFactory.connect(), segmentGranularity, windowPeriod); + synchronized (lock) { + if (shutdown) { + return TaskStatus.success(getId()); + } + firehose = new GracefulShutdownFirehose(firehoseFactory.connect(), segmentGranularity, windowPeriod); + } // TODO -- Take PlumberSchool in constructor (although that will need jackson injectables for stuff like // TODO -- the ServerView, which seems kind of odd?)