|
@@ -18,9 +18,9 @@
|
|
|
|
|
|
package org.apache.hadoop.yarn.event;
|
|
package org.apache.hadoop.yarn.event;
|
|
|
|
|
|
|
|
+import com.google.common.annotations.VisibleForTesting;
|
|
import org.apache.commons.logging.Log;
|
|
import org.apache.commons.logging.Log;
|
|
import org.apache.commons.logging.LogFactory;
|
|
import org.apache.commons.logging.LogFactory;
|
|
-import org.apache.hadoop.conf.Configuration;
|
|
|
|
import org.apache.hadoop.service.AbstractService;
|
|
import org.apache.hadoop.service.AbstractService;
|
|
import org.apache.hadoop.util.ShutdownHookManager;
|
|
import org.apache.hadoop.util.ShutdownHookManager;
|
|
import org.apache.hadoop.yarn.exceptions.YarnRuntimeException;
|
|
import org.apache.hadoop.yarn.exceptions.YarnRuntimeException;
|
|
@@ -44,7 +44,7 @@ public class EventDispatcher<T extends Event> extends
|
|
new LinkedBlockingDeque<>();
|
|
new LinkedBlockingDeque<>();
|
|
private final Thread eventProcessor;
|
|
private final Thread eventProcessor;
|
|
private volatile boolean stopped = false;
|
|
private volatile boolean stopped = false;
|
|
- private boolean shouldExitOnError = false;
|
|
|
|
|
|
+ private boolean shouldExitOnError = true;
|
|
|
|
|
|
private static final Log LOG = LogFactory.getLog(EventDispatcher.class);
|
|
private static final Log LOG = LogFactory.getLog(EventDispatcher.class);
|
|
|
|
|
|
@@ -91,14 +91,6 @@ public class EventDispatcher<T extends Event> extends
|
|
this.eventProcessor.setName(getName() + ":Event Processor");
|
|
this.eventProcessor.setName(getName() + ":Event Processor");
|
|
}
|
|
}
|
|
|
|
|
|
- @Override
|
|
|
|
- protected void serviceInit(Configuration conf) throws Exception {
|
|
|
|
- this.shouldExitOnError =
|
|
|
|
- conf.getBoolean(Dispatcher.DISPATCHER_EXIT_ON_ERROR_KEY,
|
|
|
|
- Dispatcher.DEFAULT_DISPATCHER_EXIT_ON_ERROR);
|
|
|
|
- super.serviceInit(conf);
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
@Override
|
|
@Override
|
|
protected void serviceStart() throws Exception {
|
|
protected void serviceStart() throws Exception {
|
|
this.eventProcessor.start();
|
|
this.eventProcessor.start();
|
|
@@ -134,4 +126,9 @@ public class EventDispatcher<T extends Event> extends
|
|
LOG.info("Interrupted. Trying to exit gracefully.");
|
|
LOG.info("Interrupted. Trying to exit gracefully.");
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
+
|
|
|
|
+ @VisibleForTesting
|
|
|
|
+ public void disableExitOnError() {
|
|
|
|
+ shouldExitOnError = false;
|
|
|
|
+ }
|
|
}
|
|
}
|