Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPascal Rapicault2006-01-09 23:49:53 +0000
committerPascal Rapicault2006-01-09 23:49:53 +0000
commit30febef25fb6f70edf95b30a905d7922621210f2 (patch)
tree93ca4ed684c5514fa4c7e899a72a83045009ca9d
parentac798a6fccc6386078e7e922541fa017342d581a (diff)
downloadrt.equinox.bundles-30febef25fb6f70edf95b30a905d7922621210f2.tar.gz
rt.equinox.bundles-30febef25fb6f70edf95b30a905d7922621210f2.tar.xz
rt.equinox.bundles-30febef25fb6f70edf95b30a905d7922621210f2.zip
Bug 121899 - Improve performance of RegistryStrategyOSGI.getContributingBundlev20060109
-rw-r--r--bundles/org.eclipse.equinox.registry/src/org/eclipse/core/internal/registry/osgi/RegistryStrategyOSGI.java20
1 files changed, 15 insertions, 5 deletions
diff --git a/bundles/org.eclipse.equinox.registry/src/org/eclipse/core/internal/registry/osgi/RegistryStrategyOSGI.java b/bundles/org.eclipse.equinox.registry/src/org/eclipse/core/internal/registry/osgi/RegistryStrategyOSGI.java
index 4588594cd..8f49b09e2 100644
--- a/bundles/org.eclipse.equinox.registry/src/org/eclipse/core/internal/registry/osgi/RegistryStrategyOSGI.java
+++ b/bundles/org.eclipse.equinox.registry/src/org/eclipse/core/internal/registry/osgi/RegistryStrategyOSGI.java
@@ -14,8 +14,7 @@ import java.io.File;
import java.io.IOException;
import java.net.URL;
import java.net.URLConnection;
-import java.util.Map;
-import java.util.ResourceBundle;
+import java.util.*;
import javax.xml.parsers.SAXParserFactory;
import org.eclipse.core.internal.registry.*;
import org.eclipse.core.internal.runtime.ResourceTranslator;
@@ -137,11 +136,22 @@ public class RegistryStrategyOSGI extends RegistryStrategy {
////////////////////////////////////////////////////////////////////////////////////////
// Use OSGi bundles for namespace resolution (contributors: plugins and fragments)
- static private Bundle getContributingBundle(long contributingBundleId) {
- return Activator.getContext().getBundle(contributingBundleId);
+ // We don't expect mapping to change during the runtime. (Or, in the OSGI terms,
+ // we don't expect bundle IDs to be resused during the Eclipse run.)
+ private Map bundleMap = new HashMap();
+
+ private Bundle getContributingBundle(long contributingBundleId) {
+ // see if we have it in the cache
+ Long objectId = new Long(contributingBundleId);
+ Bundle bundle = (Bundle) bundleMap.get(objectId);
+ if (bundle != null)
+ return bundle;
+ bundle = Activator.getContext().getBundle(contributingBundleId);
+ bundleMap.put(objectId, bundle);
+ return bundle;
}
- static private Bundle getNamespaceBundle(long contributingBundleId) {
+ private Bundle getNamespaceBundle(long contributingBundleId) {
Bundle contributingBundle = getContributingBundle(contributingBundleId);
if (contributingBundle == null) // When restored from disk the underlying bundle may have been uninstalled
throw new IllegalStateException("Internal error in extension registry. The bundle corresponding to this contribution has been uninstalled."); //$NON-NLS-1$

Back to the top