Clear the queue once the reader thread sees that it needs to stop.
Original commit: elastic/x-pack-elasticsearch@b70a224ff1
This commit is contained in:
parent
1cd5ae6a31
commit
27f83bb621
|
@ -132,7 +132,6 @@ public class AlertActionManager extends AbstractComponent {
|
||||||
|
|
||||||
public void stop() {
|
public void stop() {
|
||||||
if (started.compareAndSet(true, false)) {
|
if (started.compareAndSet(true, false)) {
|
||||||
actionsToBeProcessed.clear();
|
|
||||||
actionsToBeProcessed.add(END_ENTRY);
|
actionsToBeProcessed.add(END_ENTRY);
|
||||||
logger.info("Stopped job queue");
|
logger.info("Stopped job queue");
|
||||||
}
|
}
|
||||||
|
@ -357,6 +356,7 @@ public class AlertActionManager extends AbstractComponent {
|
||||||
while (started()) {
|
while (started()) {
|
||||||
AlertActionEntry entry = actionsToBeProcessed.take();
|
AlertActionEntry entry = actionsToBeProcessed.take();
|
||||||
if (!started() || entry == END_ENTRY) {
|
if (!started() || entry == END_ENTRY) {
|
||||||
|
actionsToBeProcessed.clear();
|
||||||
logger.info("Stopping thread to read from the job queue");
|
logger.info("Stopping thread to read from the job queue");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue