未验证 提交 a2eddd69 编写于 作者: wu-sheng's avatar wu-sheng 提交者: GitHub

Fix the cache unclear bug. (#4739)

* Fix the cache unclear bug.

* Update LimitedSizeBufferedData.java
Co-authored-by: Nkezhenxu94 <kezhenxu94@apache.org>
上级 c33f5838
......@@ -74,8 +74,12 @@ public class LimitedSizeBufferedData<STORAGE_DATA extends ComparableStorageData
@Override
public List<STORAGE_DATA> read() {
List<STORAGE_DATA> collection = new ArrayList<>();
data.values().forEach(e -> e.forEach(collection::add));
return collection;
try {
List<STORAGE_DATA> collection = new ArrayList<>();
data.values().forEach(collection::addAll);
return collection;
} finally {
data.clear();
}
}
}
......@@ -57,6 +57,10 @@ public class MergableBufferedData<METRICS extends Metrics> implements BufferedDa
@Override
public List<METRICS> read() {
return buffer.values().stream().collect(Collectors.toList());
try {
return buffer.values().stream().collect(Collectors.toList());
} finally {
buffer.clear();
}
}
}
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册