change shutdown logic for firehose

This commit is contained in:
Fangjin Yang 2013-04-12 11:49:01 -07:00
parent 465b78b4bc
commit a24274029f
1 changed files with 7 additions and 6 deletions

View File

@ -118,6 +118,12 @@ 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??!");
}
@ -133,12 +139,7 @@ public class RealtimeIndexTask extends AbstractTask
final FireDepartmentMetrics metrics = new FireDepartmentMetrics();
final Period intermediatePersistPeriod = fireDepartmentConfig.getIntermediatePersistPeriod();
synchronized (lock) {
firehose = new GracefulShutdownFirehose(firehoseFactory.connect(), segmentGranularity, windowPeriod);
if (shutdown) {
firehose.shutdown();
}
}
// TODO -- Take PlumberSchool in constructor (although that will need jackson injectables for stuff like
// TODO -- the ServerView, which seems kind of odd?)