1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-04-22 06:02:11 +02:00

Bug 526391 - Make Database.stringCache a ConcurrentHashMap since it can be accessed concurrently by multiple threads

Change-Id: I79b88197ade9831100b13e5429bfb62248a28f06
This commit is contained in:
Nathan Ridge 2017-10-24 19:55:26 -04:00
parent acd931e2b6
commit 4bf930decb

View file

@ -26,8 +26,8 @@ import java.nio.channels.ClosedByInterruptException;
import java.nio.channels.ClosedChannelException; import java.nio.channels.ClosedChannelException;
import java.nio.channels.FileChannel; import java.nio.channels.FileChannel;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.HashMap;
import java.util.Map; import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
import org.eclipse.cdt.core.CCorePlugin; import org.eclipse.cdt.core.CCorePlugin;
import org.eclipse.core.runtime.CoreException; import org.eclipse.core.runtime.CoreException;
@ -128,7 +128,7 @@ public class Database {
} }
// a cache for strings which is used for btree lookups; soft refs ensure garbage collection // a cache for strings which is used for btree lookups; soft refs ensure garbage collection
private final Map<Long, Reference<IString>> stringCache = new HashMap<>(); private final Map<Long, Reference<IString>> stringCache = new ConcurrentHashMap<>();
private final ReferenceQueue<IString> stringDisposal = new ReferenceQueue<>(); private final ReferenceQueue<IString> stringDisposal = new ReferenceQueue<>();
/** /**