Skip to content

Commit e9f9536

Browse files
committed
Change fileSystems to use ConcurrentHashMap
See #1137 See #1114
1 parent a05b110 commit e9f9536

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

resources/bundles/org.eclipse.core.filesystem/src/org/eclipse/core/internal/filesystem/InternalFileSystemCore.java

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,9 @@
1414
package org.eclipse.core.internal.filesystem;
1515

1616
import java.net.URI;
17-
import java.util.HashMap;
17+
import java.util.Map;
18+
import java.util.concurrent.ConcurrentHashMap;
19+
import java.util.concurrent.ConcurrentMap;
1820
import org.eclipse.core.filesystem.EFS;
1921
import org.eclipse.core.filesystem.IFileStore;
2022
import org.eclipse.core.filesystem.IFileSystem;
@@ -43,7 +45,7 @@ public class InternalFileSystemCore implements IRegistryChangeListener {
4345
* element for the extension. Once the file system has been created, the
4446
* map contains the IFileSystem instance for that scheme.
4547
*/
46-
private HashMap<String, Object> fileSystems;
48+
private ConcurrentMap<String, Object> fileSystems;
4749

4850
/**
4951
* Returns the singleton instance of this class.
@@ -71,7 +73,7 @@ private InternalFileSystemCore() {
7173
public IFileSystem getFileSystem(String scheme) throws CoreException {
7274
if (scheme == null)
7375
throw new NullPointerException();
74-
final HashMap<String, Object> registry = getFileSystemRegistry();
76+
final Map<String, Object> registry = getFileSystemRegistry();
7577
Object result = registry.get(scheme);
7678
if (result == null)
7779
Policy.error(EFS.ERROR_INTERNAL, NLS.bind(Messages.noFileSystem, scheme));
@@ -129,9 +131,9 @@ public IFileStore getStore(URI uri) throws CoreException {
129131
* Returns the fully initialized file system registry
130132
* @return The file system registry
131133
*/
132-
private synchronized HashMap<String, Object> getFileSystemRegistry() {
134+
private synchronized ConcurrentMap<String, Object> getFileSystemRegistry() {
133135
if (fileSystems == null) {
134-
fileSystems = new HashMap<>();
136+
fileSystems = new ConcurrentHashMap<>();
135137
IExtensionPoint point = RegistryFactory.getRegistry().getExtensionPoint(EFS.PI_FILE_SYSTEM, EFS.PT_FILE_SYSTEMS);
136138
IExtension[] extensions = point.getExtensions();
137139
for (IExtension extension : extensions) {

0 commit comments

Comments
 (0)