|
19 | 19 | import java.net.URISyntaxException;
|
20 | 20 | import java.util.ArrayList;
|
21 | 21 | import java.util.Arrays;
|
| 22 | +import java.util.Collections; |
22 | 23 | import java.util.HashMap;
|
23 | 24 | import java.util.HashSet;
|
24 | 25 | import java.util.LinkedHashSet;
|
@@ -94,11 +95,12 @@ public abstract class AbstractLanguageSettingsOutputScanner extends LanguageSett
|
94 | 95 |
|
95 | 96 | private static final int FIND_RESOURCES_CACHE_SIZE = 100;
|
96 | 97 |
|
97 |
| - private LRUCache<URI, IResource[]> workspaceRootFindContainersForLocationURICache = new LRUCache<>( |
98 |
| - FIND_RESOURCES_CACHE_SIZE); |
99 |
| - private LRUCache<URI, IResource[]> workspaceRootFindFilesForLocationURICache = new LRUCache<>( |
100 |
| - FIND_RESOURCES_CACHE_SIZE); |
101 |
| - private HashMap<IProject, LRUCache<IPath, List<IResource>>> findPathInProjectCache = new HashMap<>(); |
| 98 | + private Map<URI, IResource[]> workspaceRootFindContainersForLocationURICache = Collections |
| 99 | + .synchronizedMap(new LRUCache<>(FIND_RESOURCES_CACHE_SIZE)); |
| 100 | + private Map<URI, IResource[]> workspaceRootFindFilesForLocationURICache = Collections |
| 101 | + .synchronizedMap(new LRUCache<>(FIND_RESOURCES_CACHE_SIZE)); |
| 102 | + private Map<IProject, LRUCache<IPath, List<IResource>>> findPathInProjectCache = Collections |
| 103 | + .synchronizedMap(new HashMap<>()); |
102 | 104 |
|
103 | 105 | //String pathStr, URI baseURI -> URI
|
104 | 106 | private static class MappedURIKey {
|
@@ -144,11 +146,14 @@ public boolean equals(Object obj) {
|
144 | 146 | }
|
145 | 147 |
|
146 | 148 | // Caches the result of determineMappedURI
|
147 |
| - private LRUCache<MappedURIKey, URI> mappedURICache = new LRUCache<>(FIND_RESOURCES_CACHE_SIZE); |
| 149 | + private Map<MappedURIKey, URI> mappedURICache = Collections |
| 150 | + .synchronizedMap(new LRUCache<>(FIND_RESOURCES_CACHE_SIZE)); |
148 | 151 | // Caches the result of getFilesystemLocation
|
149 |
| - private LRUCache<URI, IPath> fileSystemLocationCache = new LRUCache<>(FIND_RESOURCES_CACHE_SIZE); |
| 152 | + private Map<URI, IPath> fileSystemLocationCache = Collections |
| 153 | + .synchronizedMap(new LRUCache<>(FIND_RESOURCES_CACHE_SIZE)); |
150 | 154 | // Caches the result of new File(pathname).exists()
|
151 |
| - private LRUCache<IPath, Boolean> pathExistsCache = new LRUCache<>(FIND_RESOURCES_CACHE_SIZE); |
| 155 | + private Map<IPath, Boolean> pathExistsCache = Collections |
| 156 | + .synchronizedMap(new LRUCache<>(FIND_RESOURCES_CACHE_SIZE)); |
152 | 157 |
|
153 | 158 | /** @since 8.2 */
|
154 | 159 | protected EFSExtensionProvider efsProvider = null;
|
|
0 commit comments