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>
Sat, 2 Nov 2024 15:06:58 +0000 (16:06 +0100)
src/main/java/de/juplo/kafka/ExampleConsumer.java

index 3552689..4179331 100644 (file)
@@ -360,12 +360,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);
         }
       }
     });