Change manual stop semantics.
This change sets the manually stopped flag even if manual stop is requested but the watcher is not started. Also clears the manually stopped flag if a manual start is initiated. Original commit: elastic/x-pack-elasticsearch@6d5fd897ba
This commit is contained in:
parent
287a612179
commit
3051cca896
|
@ -55,13 +55,15 @@ public class WatcherLifeCycleService extends AbstractComponent implements Cluste
|
|||
}
|
||||
|
||||
private synchronized void stop(boolean manual) {
|
||||
//This is set here since even if we are not started if we have requested a manual stop we do not want an automatic start to start watcher
|
||||
manuallyStopped = manual;
|
||||
|
||||
WatcherState watcherState = watcherService.state();
|
||||
if (watcherState != WatcherState.STARTED) {
|
||||
logger.debug("not stopping watcher. watcher can only stop if its current state is [{}], but its current state now is [{}]", WatcherState.STARTED, watcherState);
|
||||
return;
|
||||
}
|
||||
|
||||
manuallyStopped = manual;
|
||||
watcherService.stop();
|
||||
}
|
||||
|
||||
|
@ -79,6 +81,11 @@ public class WatcherLifeCycleService extends AbstractComponent implements Cluste
|
|||
return;
|
||||
}
|
||||
|
||||
//If we are manually starting we should clear the manuallyStopped flag
|
||||
if (manual && manuallyStopped) {
|
||||
manuallyStopped = false;
|
||||
}
|
||||
|
||||
if (!watcherService.validate(state)) {
|
||||
logger.debug("not starting watcher. because the cluster isn't ready yet to run watcher");
|
||||
return;
|
||||
|
|
Loading…
Reference in New Issue