|
17 | 17 | import java.io.File; |
18 | 18 | import java.io.IOException; |
19 | 19 | import java.util.HashMap; |
20 | | -import java.util.Map.Entry; |
21 | 20 |
|
22 | 21 | import org.eclipse.core.runtime.CoreException; |
23 | 22 | import org.eclipse.core.runtime.IProgressMonitor; |
@@ -66,7 +65,7 @@ public abstract class AbstractBundleContainer extends PlatformObject implements |
66 | 65 | */ |
67 | 66 | private String[] fVMArgs; |
68 | 67 |
|
69 | | - static private HashMap<AbstractBundleContainer, String[]> hash = new HashMap<>(); |
| 68 | + private static final HashMap<AbstractBundleContainer, String[]> fVMArgsCache = new HashMap<>(); |
70 | 69 |
|
71 | 70 | /** |
72 | 71 | * Resolves any string substitution variables in the given text returning |
@@ -223,11 +222,11 @@ protected void clearResolutionStatus() { |
223 | 222 |
|
224 | 223 | @Override |
225 | 224 | public String[] getVMArguments() { |
226 | | - for (Entry<AbstractBundleContainer, String[]> entry : hash.entrySet()) { |
227 | | - if (entry.getKey().equals(this)) { |
228 | | - return entry.getValue(); |
229 | | - } |
| 225 | + String[] cachedArgs = fVMArgsCache.get(this); |
| 226 | + if (cachedArgs != null) { |
| 227 | + return cachedArgs; |
230 | 228 | } |
| 229 | + |
231 | 230 | String FWK_ADMIN_EQ = "org.eclipse.equinox.frameworkadmin.equinox"; //$NON-NLS-1$ |
232 | 231 | if (fVMArgs == null) { |
233 | 232 | try { |
@@ -261,10 +260,10 @@ public String[] getVMArguments() { |
261 | 260 |
|
262 | 261 | } |
263 | 262 | if (fVMArgs == null || fVMArgs.length == 0) { |
264 | | - hash.put(this, null); |
| 263 | + fVMArgsCache.put(this, null); |
265 | 264 | return null; |
266 | 265 | } |
267 | | - hash.put(this, fVMArgs); |
| 266 | + fVMArgsCache.put(this, fVMArgs); |
268 | 267 | return fVMArgs; |
269 | 268 | } |
270 | 269 |
|
|
0 commit comments