fix thread-safe bug

wrap WeakHashMap with Collections.synchronizedMap, because it can be used by many worker threads.
This commit is contained in:
Wu Yongzheng
2017-12-21 16:00:11 +08:00
committed by GitHub
parent f101e9a775
commit 0e2c4d4af1
@@ -23,7 +23,7 @@ import org.slf4j.LoggerFactory;
public class ClspGraph {
private static final Logger LOG = LoggerFactory.getLogger(ClspGraph.class);
private final Map<String, Set<String>> ancestorCache = new WeakHashMap<String, Set<String>>();
private final Map<String, Set<String>> ancestorCache = Collections.synchronizedMap(new WeakHashMap<String, Set<String>>());
private Map<String, NClass> nameMap;
private final Set<String> missingClasses = new HashSet<String>();