From: Kai Moritz Date: Sat, 2 Nov 2024 10:34:38 +0000 (+0100) Subject: Refactor: Neue, klarere ``switch``-Syntax X-Git-Tag: consumer/spring-consumer--log-compaction--2024-11-13--si~10 X-Git-Url: http://juplo.de/gitweb/?a=commitdiff_plain;h=b7f6930475e7e9d562dfc655e7ccdd470b848da9;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 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); } } });