Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHermann Czedik-Eysenberg2018-09-21 13:48:38 +0000
committerThomas Watson2018-09-21 20:09:33 +0000
commite3aa57fd2faa12af75a91e43f77d305613953139 (patch)
treeff50d61cd5d03d3041117d6628b91cea292a4c5e
parent2e8cefa09e303a22a8a7cb954d0c8938d5091911 (diff)
downloadrt.equinox.bundles-e3aa57fd2faa12af75a91e43f77d305613953139.tar.gz
rt.equinox.bundles-e3aa57fd2faa12af75a91e43f77d305613953139.tar.xz
rt.equinox.bundles-e3aa57fd2faa12af75a91e43f77d305613953139.zip
Signed-off-by: Hermann Czedik-Eysenberg <hermann.czedik-eysenberg@agfa.com> Change-Id: Id99490fcef63997291651cf0d5c0fab626f7474a
-rw-r--r--bundles/org.eclipse.equinox.registry/META-INF/MANIFEST.MF2
-rw-r--r--bundles/org.eclipse.equinox.registry/pom.xml2
-rw-r--r--bundles/org.eclipse.equinox.registry/src/org/eclipse/core/internal/registry/osgi/RegistryStrategyOSGI.java20
3 files changed, 20 insertions, 4 deletions
diff --git a/bundles/org.eclipse.equinox.registry/META-INF/MANIFEST.MF b/bundles/org.eclipse.equinox.registry/META-INF/MANIFEST.MF
index e7397c46e..aa63a0504 100644
--- a/bundles/org.eclipse.equinox.registry/META-INF/MANIFEST.MF
+++ b/bundles/org.eclipse.equinox.registry/META-INF/MANIFEST.MF
@@ -2,7 +2,7 @@ Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: %pluginName
Bundle-SymbolicName: org.eclipse.equinox.registry;singleton:=true
-Bundle-Version: 3.8.100.qualifier
+Bundle-Version: 3.8.200.qualifier
Bundle-Localization: plugin
Export-Package: org.eclipse.core.internal.adapter;x-internal:=true,
org.eclipse.core.internal.registry;x-friends:="org.eclipse.core.runtime",
diff --git a/bundles/org.eclipse.equinox.registry/pom.xml b/bundles/org.eclipse.equinox.registry/pom.xml
index 803983f43..8eb6b6b81 100644
--- a/bundles/org.eclipse.equinox.registry/pom.xml
+++ b/bundles/org.eclipse.equinox.registry/pom.xml
@@ -19,6 +19,6 @@
</parent>
<groupId>org.eclipse.equinox</groupId>
<artifactId>org.eclipse.equinox.registry</artifactId>
- <version>3.8.100-SNAPSHOT</version>
+ <version>3.8.200-SNAPSHOT</version>
<packaging>eclipse-plugin</packaging>
</project>
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 83e959310..4ba193ba0 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
@@ -18,6 +18,8 @@ import java.io.IOException;
import java.net.URL;
import java.util.Locale;
import java.util.ResourceBundle;
+import java.util.concurrent.locks.ReadWriteLock;
+import java.util.concurrent.locks.ReentrantReadWriteLock;
import javax.xml.parsers.SAXParserFactory;
import org.eclipse.core.internal.registry.*;
import org.eclipse.core.internal.runtime.ResourceTranslator;
@@ -136,6 +138,8 @@ public class RegistryStrategyOSGI extends RegistryStrategy {
*/
private final ReferenceMap bundleMap = new ReferenceMap(ReferenceMap.SOFT, DEFAULT_BUNDLECACHE_SIZE, DEFAULT_BUNDLECACHE_LOADFACTOR);
+ private ReadWriteLock bundleMapLock = new ReentrantReadWriteLock();
+
// String Id to OSGi Bundle conversion
private Bundle getBundle(String id) {
if (id == null)
@@ -149,11 +153,23 @@ public class RegistryStrategyOSGI extends RegistryStrategy {
// We assume here that OSGI Id will fit into "int". As the number of
// registry elements themselves are expected to fit into "int", this
// is a valid assumption for the time being.
- Bundle bundle = (Bundle) bundleMap.get((int) OSGiId);
+ Bundle bundle;
+ bundleMapLock.readLock().lock();
+ try {
+ bundle = (Bundle) bundleMap.get((int) OSGiId);
+ } finally {
+ bundleMapLock.readLock().unlock();
+ }
if (bundle != null)
return bundle;
+ // note: we accept that two concurrent threads end up here for the same id, because they will anyway resolve the same mapping
bundle = Activator.getContext().getBundle(OSGiId);
- bundleMap.put((int) OSGiId, bundle);
+ bundleMapLock.writeLock().lock();
+ try {
+ bundleMap.put((int) OSGiId, bundle);
+ } finally {
+ bundleMapLock.writeLock().unlock();
+ }
return bundle;
}

Back to the top