From 585e1fa6402a771a15b24ede41ac13ec1d034a85 Mon Sep 17 00:00:00 2001 From: Kai Moritz Date: Sat, 2 Sep 2023 10:09:53 +0200 Subject: [PATCH] WIP --- .../chat/backend/domain/LoadInProgressException.java | 7 +------ .../backend/persistence/kafka/ChatRoomChannel.java | 2 -- .../chat/backend/persistence/kafka/KafkaChatHome.java | 11 ++++------- src/test/resources/application.yml | 2 +- 4 files changed, 6 insertions(+), 16 deletions(-) diff --git a/src/main/java/de/juplo/kafka/chat/backend/domain/LoadInProgressException.java b/src/main/java/de/juplo/kafka/chat/backend/domain/LoadInProgressException.java index 45925026..d87e76d3 100644 --- a/src/main/java/de/juplo/kafka/chat/backend/domain/LoadInProgressException.java +++ b/src/main/java/de/juplo/kafka/chat/backend/domain/LoadInProgressException.java @@ -1,15 +1,10 @@ package de.juplo.kafka.chat.backend.domain; -import java.util.concurrent.atomic.AtomicInteger; - - public class LoadInProgressException extends IllegalStateException { - static AtomicInteger counter = new AtomicInteger(); - public LoadInProgressException() { - super("Load in progress... " + counter.incrementAndGet()); + super("Load in progress..."); } } diff --git a/src/main/java/de/juplo/kafka/chat/backend/persistence/kafka/ChatRoomChannel.java b/src/main/java/de/juplo/kafka/chat/backend/persistence/kafka/ChatRoomChannel.java index ad9531cb..234554eb 100644 --- a/src/main/java/de/juplo/kafka/chat/backend/persistence/kafka/ChatRoomChannel.java +++ b/src/main/java/de/juplo/kafka/chat/backend/persistence/kafka/ChatRoomChannel.java @@ -369,13 +369,11 @@ public class ChatRoomChannel implements Runnable, ConsumerRebalanceListener { if (loadInProgress) { - log.error("Load in progress!"); return Mono.error(new LoadInProgressException()); } if (!isShardOwned[shard]) { - log.error("Shard {} for chat-room {} not owned!", shard, id); return Mono.error(new ShardNotOwnedException(shard)); } diff --git a/src/main/java/de/juplo/kafka/chat/backend/persistence/kafka/KafkaChatHome.java b/src/main/java/de/juplo/kafka/chat/backend/persistence/kafka/KafkaChatHome.java index 2788343f..07fb8858 100644 --- a/src/main/java/de/juplo/kafka/chat/backend/persistence/kafka/KafkaChatHome.java +++ b/src/main/java/de/juplo/kafka/chat/backend/persistence/kafka/KafkaChatHome.java @@ -26,13 +26,10 @@ public class KafkaChatHome implements ChatHome int shard = selectShard(id); return chatRoomChannel .getChatRoom(shard, id) - .switchIfEmpty(Mono.error(() -> { - log.error("Unknown chat-room {} (shard={})!", id, shard); - return new UnknownChatroomException( - id, - shard, - chatRoomChannel.getOwnedShards()); - })); + .switchIfEmpty(Mono.error(() -> new UnknownChatroomException( + id, + shard, + chatRoomChannel.getOwnedShards()))); } int selectShard(UUID chatRoomId) diff --git a/src/test/resources/application.yml b/src/test/resources/application.yml index 856b2e24..96b0cb3b 100644 --- a/src/test/resources/application.yml +++ b/src/test/resources/application.yml @@ -1,4 +1,4 @@ logging: level: root: INFO - de.juplo.kafka.chat.backend: TRACE + de.juplo.kafka.chat.backend: DEBUG -- 2.20.1