Refactor: Neue, klarere ``switch``-Syntax
authorKai Moritz <kai@juplo.de>
Sat, 2 Nov 2024 10:34:38 +0000 (11:34 +0100)
committerKai Moritz <kai@juplo.de>
Fri, 8 Nov 2024 17:21:16 +0000 (18:21 +0100)
src/main/java/de/juplo/kafka/ExampleConsumer.java

index b08b209..fa2dacb 100644 (file)
@@ -368,12 +368,8 @@ public class ExampleConsumer implements Runnable, ConsumerRebalanceListener
         PartitionState partitionState = partitionStates[partition.partition()];
         switch (partitionState)
         {
-          case RESTORING, ASSIGNED:
-            stateUnassigned(partition.partition());
-            break;
-          default:
-          case UNASSIGNED:
-            log.warn("{} - partition {} in state {} was revoked!", id, partition, partitionState);
+          case RESTORING, ASSIGNED -> stateUnassigned(partition.partition());
+          case UNASSIGNED -> log.warn("{} - partition {} in state {} was revoked!", id, partition, partitionState);
         }
       }
     });