From 27f83bb6218160e6fea5e9d790a9fe41dfb9e56d Mon Sep 17 00:00:00 2001 From: Martijn van Groningen Date: Thu, 27 Nov 2014 12:14:30 +0100 Subject: [PATCH] Clear the queue once the reader thread sees that it needs to stop. Original commit: elastic/x-pack-elasticsearch@b70a224ff1463dd2de334ddd59c4d8950a2095cf --- .../org/elasticsearch/alerts/actions/AlertActionManager.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/org/elasticsearch/alerts/actions/AlertActionManager.java b/src/main/java/org/elasticsearch/alerts/actions/AlertActionManager.java index 1414196d9d4..f3f9adbb450 100644 --- a/src/main/java/org/elasticsearch/alerts/actions/AlertActionManager.java +++ b/src/main/java/org/elasticsearch/alerts/actions/AlertActionManager.java @@ -132,7 +132,6 @@ public class AlertActionManager extends AbstractComponent { public void stop() { if (started.compareAndSet(true, false)) { - actionsToBeProcessed.clear(); actionsToBeProcessed.add(END_ENTRY); logger.info("Stopped job queue"); } @@ -357,6 +356,7 @@ public class AlertActionManager extends AbstractComponent { while (started()) { AlertActionEntry entry = actionsToBeProcessed.take(); if (!started() || entry == END_ENTRY) { + actionsToBeProcessed.clear(); logger.info("Stopping thread to read from the job queue"); return; }