From 053483a919e5e988f0c2728044234839bb4be460 Mon Sep 17 00:00:00 2001 From: ymlam Date: Mon, 5 Sep 2022 13:26:36 -0400 Subject: [PATCH] Fix bug of not stopping immediately on CANCEL while PAUSED. The service threads do not terminate immediately, but, instead each service thread picks up one more job before terminating, causing servicing more jobs which are not reported back to portal. --- src/main/java/altk/comm/engine/Broadcast.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/main/java/altk/comm/engine/Broadcast.java b/src/main/java/altk/comm/engine/Broadcast.java index 1c0a21d..6303076 100644 --- a/src/main/java/altk/comm/engine/Broadcast.java +++ b/src/main/java/altk/comm/engine/Broadcast.java @@ -290,7 +290,7 @@ public abstract class Broadcast public void run() { myLogger.info("Thread starting..."); - while (! serviceThreadsShouldStop()) + for (;;) { if (serviceThreadsShouldPause()) { @@ -308,6 +308,7 @@ public abstract class Broadcast } } } + if (serviceThreadsShouldStop()) break; // Get a batch of jobs, if available myLogger.debug("Looking for jobs"); List batch = new ArrayList();