mirror of
https://gitee.com/dromara/hutool.git
synced 2025-06-28 13:34:09 +08:00
修复putWithoutLock存在的外部资源泄露问题
This commit is contained in:
parent
420e54a37d
commit
7739f8b015
@ -89,7 +89,11 @@ public abstract class AbstractCache<K, V> implements Cache<K, V> {
|
|||||||
|
|
||||||
// issue#3618 对于替换的键值对,不做满队列检查和清除
|
// issue#3618 对于替换的键值对,不做满队列检查和清除
|
||||||
if (cacheMap.containsKey(mKey)) {
|
if (cacheMap.containsKey(mKey)) {
|
||||||
// 存在相同key,覆盖之
|
CacheObj<K, V> oldObj = cacheMap.get(mKey);
|
||||||
|
if (oldObj != null) {
|
||||||
|
onRemove(oldObj.key, oldObj.obj);
|
||||||
|
cacheMap.remove(mKey);
|
||||||
|
}
|
||||||
cacheMap.put(mKey, co);
|
cacheMap.put(mKey, co);
|
||||||
} else {
|
} else {
|
||||||
if (isFull()) {
|
if (isFull()) {
|
||||||
|
Loading…
Reference in New Issue
Block a user