From 80d434f188bb627fda75755a83dd3f170e2a7ec5 Mon Sep 17 00:00:00 2001 From: Kai Moritz Date: Sat, 2 Nov 2024 11:34:38 +0100 Subject: [PATCH] Refactor: Neue, klarere ``switch``-Syntax --- src/main/java/de/juplo/kafka/ExampleConsumer.java | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/src/main/java/de/juplo/kafka/ExampleConsumer.java b/src/main/java/de/juplo/kafka/ExampleConsumer.java index b08b209..fa2dacb 100644 --- a/src/main/java/de/juplo/kafka/ExampleConsumer.java +++ b/src/main/java/de/juplo/kafka/ExampleConsumer.java @@ -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); } } }); -- 2.20.1