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>
Sun, 10 Nov 2024 13:27:08 +0000 (14:27 +0100)
src/main/java/de/juplo/kafka/ExampleConsumer.java

index e687a36..d852f41 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);
         }
       }
     });