Skip to main content
summaryrefslogtreecommitdiffstats
path: root/core
diff options
context:
space:
mode:
authorJames Blackburn2009-08-18 16:02:21 -0400
committerJames Blackburn2009-08-18 16:02:21 -0400
commit5c185d3f88d958380e72a7aa7e974bccf3efe5fb (patch)
treecf4594c00ff5c543dd828e538a12d9d49574ef40 /core
parent0f6a42cb35bdab881e30ea9636dddb1f15a1be33 (diff)
downloadorg.eclipse.cdt-5c185d3f88d958380e72a7aa7e974bccf3efe5fb.tar.gz
org.eclipse.cdt-5c185d3f88d958380e72a7aa7e974bccf3efe5fb.tar.xz
org.eclipse.cdt-5c185d3f88d958380e72a7aa7e974bccf3efe5fb.zip
Bug 284485 Fix potential race in getProjectDescriptionStorage(IProject project)
Diffstat (limited to 'core')
-rw-r--r--core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/settings/model/CProjectDescriptionStorageManager.java8
1 files changed, 4 insertions, 4 deletions
diff --git a/core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/settings/model/CProjectDescriptionStorageManager.java b/core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/settings/model/CProjectDescriptionStorageManager.java
index bd7ea1bce9..34897c916c 100644
--- a/core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/settings/model/CProjectDescriptionStorageManager.java
+++ b/core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/settings/model/CProjectDescriptionStorageManager.java
@@ -16,11 +16,11 @@ import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.net.URI;
-import java.util.Collections;
import java.util.HashMap;
import java.util.LinkedList;
import java.util.List;
import java.util.Map;
+import java.util.concurrent.ConcurrentHashMap;
import javax.xml.parsers.DocumentBuilder;
import javax.xml.parsers.DocumentBuilderFactory;
@@ -87,7 +87,7 @@ public class CProjectDescriptionStorageManager {
/** Map of StorageType ID -> List of StorageTypes */
private volatile Map<String, List<CProjectDescriptionStorageTypeProxy>> storageTypeMap;
/** Map from IProject -> AbstractCProjectDescriptionStorage which is responsible for (de)serializing the project */
- private Map<IProject, AbstractCProjectDescriptionStorage> fDescriptionStorageMap = Collections.synchronizedMap(new HashMap<IProject, AbstractCProjectDescriptionStorage>());
+ private ConcurrentHashMap<IProject, AbstractCProjectDescriptionStorage> fDescriptionStorageMap = new ConcurrentHashMap<IProject, AbstractCProjectDescriptionStorage>();
private volatile static CProjectDescriptionStorageManager instance;
@@ -115,9 +115,9 @@ public class CProjectDescriptionStorageManager {
AbstractCProjectDescriptionStorage projStorage = fDescriptionStorageMap.get(project);
if (projStorage == null) {
projStorage = loadProjectStorage(project);
- fDescriptionStorageMap.put(project, projStorage);
+ fDescriptionStorageMap.putIfAbsent(project, projStorage);
}
- return projStorage;
+ return fDescriptionStorageMap.get(project);
}
/**

Back to the top