diff --git a/dubbo-common/src/main/java/org/apache/dubbo/common/utils/LRUCache.java b/dubbo-common/src/main/java/org/apache/dubbo/common/utils/LRUCache.java index 76d6c19cb71..28440ba854d 100644 --- a/dubbo-common/src/main/java/org/apache/dubbo/common/utils/LRUCache.java +++ b/dubbo-common/src/main/java/org/apache/dubbo/common/utils/LRUCache.java @@ -110,6 +110,16 @@ public void clear() { } } + @Override + public V putIfAbsent(K key, V value) { + lock.lock(); + try { + return super.putIfAbsent(key, value); + } finally { + lock.unlock(); + } + } + public void lock() { lock.lock(); }