提交 32f71bb2 authored 作者: Thomas Mueller Graf's avatar Thomas Mueller Graf

Issue #231: Possible infinite loop when initializing the ObjectDataType class

上级 b9d25f10
......@@ -21,7 +21,8 @@ Change Log
<h2>Next Version (unreleased)</h2>
<ul>
<li>-
<li>Issue #231: Possible infinite loop when initializing the ObjectDataType class
when concurrently writing into MVStore.
</li>
</ul>
......
......@@ -332,8 +332,13 @@ public class ObjectDataType implements DataType {
HashMap<Class<?>, Integer> map = COMMON_CLASSES_MAP;
if (map.size() == 0) {
// lazy initialization
for (int i = 0, size = COMMON_CLASSES.length; i < size; i++) {
COMMON_CLASSES_MAP.put(COMMON_CLASSES[i], i);
// synchronized, because the COMMON_CLASSES_MAP is not
synchronized (map) {
if (map.size() == 0) {
for (int i = 0, size = COMMON_CLASSES.length; i < size; i++) {
map.put(COMMON_CLASSES[i], i);
}
}
}
}
return map.get(clazz);
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论