From 1dd0267bf92b773592e1ff7107e75059a7b0ca69 Mon Sep 17 00:00:00 2001 From: Lev Povolotsky Date: Tue, 23 Jan 2024 11:04:04 -0500 Subject: [PATCH] fix: use concurrent hashmap instead of synchroniztion for recordcache Signed-off-by: Lev Povolotsky --- .../com/hedera/node/app/spi/state/ReadableKVStateBase.java | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/hedera-node/hedera-app-spi/src/main/java/com/hedera/node/app/spi/state/ReadableKVStateBase.java b/hedera-node/hedera-app-spi/src/main/java/com/hedera/node/app/spi/state/ReadableKVStateBase.java index ac9b28283652..c2463b5bad97 100644 --- a/hedera-node/hedera-app-spi/src/main/java/com/hedera/node/app/spi/state/ReadableKVStateBase.java +++ b/hedera-node/hedera-app-spi/src/main/java/com/hedera/node/app/spi/state/ReadableKVStateBase.java @@ -74,7 +74,7 @@ public V get(@NonNull K key) { markRead(key, value); } final var value = readCache.get(key); - return (value == marker) ? null : value; + return (value == marker) ? null : value; } /** @@ -126,9 +126,8 @@ public void reset() { * @param value The value */ protected final void markRead(@NonNull K key, @Nullable V value) { - if (value == null) readCache.put(key, (V)marker); - else readCache.put(key, value); - + if (value == null) readCache.put(key, (V) marker); + else readCache.put(key, value); } /**