import java.time.*;
import java.util.*;
+import java.util.function.Function;
import java.util.stream.IntStream;
.getChatRoomInfo(id)
.map(chatRoomInfo -> chatRoomData[shard].computeIfAbsent(
id,
- (chatRoomId) ->
- {
- log.info("Creating ChatRoom {} with buffer-size {}", chatRoomId, bufferSize);
- KafkaChatMessageService service = new KafkaChatMessageService(this, chatRoomId);
- return new ChatRoomData(clock, service, bufferSize);
- }));
+ computeChatRoomData()));
+ }
+
+ private Function<UUID, ChatRoomData> computeChatRoomData()
+ {
+ return (chatRoomId) ->
+ {
+ log.info("Creating ChatRoom {} with buffer-size {}", chatRoomId, bufferSize);
+ KafkaChatMessageService service = new KafkaChatMessageService(this, chatRoomId);
+ return new ChatRoomData(clock, service, bufferSize);
+ };
}
}