diff --git a/indexing-service/src/main/java/io/druid/indexing/worker/executor/ExecutorLifecycle.java b/indexing-service/src/main/java/io/druid/indexing/worker/executor/ExecutorLifecycle.java index 6c83eea9bb8..4c398bb38d3 100644 --- a/indexing-service/src/main/java/io/druid/indexing/worker/executor/ExecutorLifecycle.java +++ b/indexing-service/src/main/java/io/druid/indexing/worker/executor/ExecutorLifecycle.java @@ -139,29 +139,31 @@ public class ExecutorLifecycle throw Throwables.propagate(e); } - // Spawn monitor thread to keep a watch on parent's stdin - // If stdin reaches eof, the parent is gone, and we should shut down - parentMonitorExec.submit( - new Runnable() - { - @Override - public void run() + if (taskExecutorConfig.isParentStreamDefined()) { + // Spawn monitor thread to keep a watch on parent's stdin + // If stdin reaches eof, the parent is gone, and we should shut down + parentMonitorExec.submit( + new Runnable() { - try { - while (parentStream.read() != -1) { - // Toss the byte + @Override + public void run() + { + try { + while (parentStream.read() != -1) { + // Toss the byte + } + } + catch (Exception e) { + log.error(e, "Failed to read from stdin"); } - } - catch (Exception e) { - log.error(e, "Failed to read from stdin"); - } - // Kind of gross, but best way to kill the JVM as far as I know - log.info("Triggering JVM shutdown."); - System.exit(2); + // Kind of gross, but best way to kill the JVM as far as I know + log.info("Triggering JVM shutdown."); + System.exit(2); + } } - } - ); + ); + } // Won't hurt in remote mode, and is required for setting up locks in local mode: try { diff --git a/indexing-service/src/main/java/io/druid/indexing/worker/executor/ExecutorLifecycleConfig.java b/indexing-service/src/main/java/io/druid/indexing/worker/executor/ExecutorLifecycleConfig.java index e25fe5739f9..5c81b848024 100644 --- a/indexing-service/src/main/java/io/druid/indexing/worker/executor/ExecutorLifecycleConfig.java +++ b/indexing-service/src/main/java/io/druid/indexing/worker/executor/ExecutorLifecycleConfig.java @@ -20,7 +20,6 @@ package io.druid.indexing.worker.executor; import com.fasterxml.jackson.annotation.JsonProperty; - import io.druid.java.util.common.ISE; import javax.validation.constraints.NotNull; @@ -43,6 +42,22 @@ public class ExecutorLifecycleConfig @JsonProperty @Pattern(regexp = "\\{stdin\\}") private String parentStreamName = "stdin"; + @JsonProperty + private boolean parentStreamDefined = true; + + /** + * Should parent stream be monitored. + */ + public boolean isParentStreamDefined() + { + return parentStreamDefined; + } + + public ExecutorLifecycleConfig setParentStreamDefined(boolean parentStreamDefined) + { + this.parentStreamDefined = parentStreamDefined; + return this; + } public File getTaskFile() {