// intercepts CTRL-C
Runtime.getRuntime().addShutdownHook(shutdownHook);
- // start watching for stop requested by other process (eg. orchestrator) if enabled
- if (watchForHardStop) {
- this.hardStopWatcher = new HardStopWatcherThread();
- this.hardStopWatcher.start();
- }
-
// start watching for restart requested by child process
- this.restartWatcher.start();
+ restartWatcher.start();
- this.javaCommands = commands;
+ javaCommands = commands;
startProcesses();
}
if (lifecycle.tryToMoveTo(State.STARTING)) {
resetFileSystem();
+ // start watching for stop requested by other process (eg. orchestrator) if enabled and not started yet
+ if (watchForHardStop && hardStopWatcher == null) {
+ hardStopWatcher = new HardStopWatcherThread();
+ hardStopWatcher.start();
+ }
+
startAndMonitorProcesses();
stopIfAnyProcessDidNotStart();
}