From b7f6930475e7e9d562dfc655e7ccdd470b848da9 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 e687a36..d852f41 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