splitter: 1.0.0-vanilla-kafka - Fixed shutdown
authorKai Moritz <kai@juplo.de>
Thu, 30 Jun 2022 16:53:46 +0000 (18:53 +0200)
committerKai Moritz <kai@juplo.de>
Thu, 30 Jun 2022 18:13:51 +0000 (20:13 +0200)
* The shutdown was blocked, because tSplitterStreamProcessor.stop()
  was called twice.
* The second time, it could no longer reach the cluster, hence, blocking
  the shutdown process.

src/main/java/de/juplo/kafka/wordcount/splitter/SplitterStreamProcessor.java

index fabae8f..0eafbda 100644 (file)
@@ -254,6 +254,11 @@ public class SplitterStreamProcessor implements Runnable
   public void stop()
   {
     log.info("Shutdown requested...");
+    if (stopped)
+    {
+      log.warn("Ignoring request: already stopped!");
+      return;
+    }
     stopped = true;
     consumer.wakeup();
     running.lock();