From: Kai Moritz Date: Sat, 2 Nov 2024 10:34:38 +0000 (+0100) Subject: Refactor: Neue, klarere ``switch``-Syntax X-Git-Url: http://juplo.de/gitweb/?a=commitdiff_plain;h=726fb3742853c59f13b9694201f265eaec904ce9;p=demos%2Fkafka%2Ftraining Refactor: Neue, klarere ``switch``-Syntax --- diff --git a/src/main/java/de/juplo/kafka/ExampleConsumer.java b/src/main/java/de/juplo/kafka/ExampleConsumer.java index 3552689..4179331 100644 --- a/src/main/java/de/juplo/kafka/ExampleConsumer.java +++ b/src/main/java/de/juplo/kafka/ExampleConsumer.java @@ -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); } } });