refactoring

pull/3118/head
Nikita Koksharov 4 years ago
parent a09c5d4ee8
commit 9b0332a358

@ -481,12 +481,6 @@ public abstract class AbstractCacheMap<K, V> implements Cache<K, V> {
} }
} }
onValueCreate(entry); onValueCreate(entry);
if (prevCachedValue != null) {
onValueRemove(prevCachedValue);
if (!isValueExpired(prevCachedValue)) {
return (V) prevCachedValue.getValue();
}
}
return null; return null;
} }

@ -668,16 +668,8 @@ public class RedisExecutor<V, R> {
Codec codecToUse = codec; Codec codecToUse = codec;
ClassLoader threadClassLoader = Thread.currentThread().getContextClassLoader(); ClassLoader threadClassLoader = Thread.currentThread().getContextClassLoader();
if (threadClassLoader != null) { if (threadClassLoader != null) {
Map<Codec, Codec> map = CODECS.get(threadClassLoader); Map<Codec, Codec> map = CODECS.computeIfAbsent(threadClassLoader, k ->
if (map == null) { new LRUCacheMap<>(200, 0, 0));
synchronized (CODECS) {
map = CODECS.get(threadClassLoader);
if (map == null) {
map = new LRUCacheMap<>(200, 0, 0);
CODECS.put(threadClassLoader, map);
}
}
}
codecToUse = map.get(codec); codecToUse = map.get(codec);
if (codecToUse == null) { if (codecToUse == null) {
try { try {

Loading…
Cancel
Save