Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJens Reimann2015-11-06 20:29:19 +0000
committerThomas Watson2015-11-06 20:31:33 +0000
commited6bd715c652c830f9eac4c9c2cd8e39e5f974a1 (patch)
treea4abd68ace92b9e43693044ba81bdac3a29e6774 /bundles/org.eclipse.equinox.cm/src
parent2c5f314960b950b26d9997adac21713674542913 (diff)
downloadrt.equinox.bundles-ed6bd715c652c830f9eac4c9c2cd8e39e5f974a1.tar.gz
rt.equinox.bundles-ed6bd715c652c830f9eac4c9c2cd8e39e5f974a1.tar.xz
rt.equinox.bundles-ed6bd715c652c830f9eac4c9c2cd8e39e5f974a1.zip
Bug 459004 - Deadlock in configuration admin when using OSGi DS
Signed-off-by: Jens Reimann <jens.reimann@ibh-systems.com>
Diffstat (limited to 'bundles/org.eclipse.equinox.cm/src')
-rw-r--r--bundles/org.eclipse.equinox.cm/src/org/eclipse/equinox/internal/cm/ConfigurationStore.java11
-rw-r--r--bundles/org.eclipse.equinox.cm/src/org/eclipse/equinox/internal/cm/ManagedServiceFactoryTracker.java18
-rw-r--r--bundles/org.eclipse.equinox.cm/src/org/eclipse/equinox/internal/cm/ManagedServiceTracker.java18
3 files changed, 21 insertions, 26 deletions
diff --git a/bundles/org.eclipse.equinox.cm/src/org/eclipse/equinox/internal/cm/ConfigurationStore.java b/bundles/org.eclipse.equinox.cm/src/org/eclipse/equinox/internal/cm/ConfigurationStore.java
index ce86b6c8..68b0f715 100644
--- a/bundles/org.eclipse.equinox.cm/src/org/eclipse/equinox/internal/cm/ConfigurationStore.java
+++ b/bundles/org.eclipse.equinox.cm/src/org/eclipse/equinox/internal/cm/ConfigurationStore.java
@@ -183,13 +183,16 @@ class ConfigurationStore {
return configurations.get(pid);
}
- public synchronized ConfigurationImpl[] getFactoryConfigurations(String factoryPid) {
+ public ConfigurationImpl[] getFactoryConfigurations(String factoryPid) {
List<ConfigurationImpl> resultList = new ArrayList<ConfigurationImpl>();
- for (Iterator<ConfigurationImpl> it = configurations.values().iterator(); it.hasNext();) {
+ synchronized (this) {
+ resultList.addAll(configurations.values());
+ }
+ for (Iterator<ConfigurationImpl> it = resultList.iterator(); it.hasNext();) {
ConfigurationImpl config = it.next();
String otherFactoryPid = config.getFactoryPid();
- if (otherFactoryPid != null && otherFactoryPid.equals(factoryPid))
- resultList.add(config);
+ if (otherFactoryPid == null || !otherFactoryPid.equals(factoryPid))
+ it.remove();
}
return resultList.toArray(new ConfigurationImpl[resultList.size()]);
}
diff --git a/bundles/org.eclipse.equinox.cm/src/org/eclipse/equinox/internal/cm/ManagedServiceFactoryTracker.java b/bundles/org.eclipse.equinox.cm/src/org/eclipse/equinox/internal/cm/ManagedServiceFactoryTracker.java
index 5506b7ff..af93f1ac 100644
--- a/bundles/org.eclipse.equinox.cm/src/org/eclipse/equinox/internal/cm/ManagedServiceFactoryTracker.java
+++ b/bundles/org.eclipse.equinox.cm/src/org/eclipse/equinox/internal/cm/ManagedServiceFactoryTracker.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2005, 2013 Cognos Incorporated, IBM Corporation and others.
+ * Copyright (c) 2005, 2015 Cognos Incorporated, IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -151,9 +151,7 @@ class ManagedServiceFactoryTracker extends ServiceTracker<ManagedServiceFactory,
if (service == null)
return null;
- synchronized (configurationStore) {
- addReference(reference, service);
- }
+ addReference(reference, service);
return service;
}
@@ -180,16 +178,14 @@ class ManagedServiceFactoryTracker extends ServiceTracker<ManagedServiceFactory,
}
}
}
- synchronized (configurationStore) {
- untrackManagedServiceFactory(reference);
- addingService(reference);
- }
+
+ untrackManagedServiceFactory(reference);
+ addingService(reference);
}
public void removedService(ServiceReference<ManagedServiceFactory> reference, ManagedServiceFactory service) {
- synchronized (configurationStore) {
- untrackManagedServiceFactory(reference);
- }
+ untrackManagedServiceFactory(reference);
+
context.ungetService(reference);
}
diff --git a/bundles/org.eclipse.equinox.cm/src/org/eclipse/equinox/internal/cm/ManagedServiceTracker.java b/bundles/org.eclipse.equinox.cm/src/org/eclipse/equinox/internal/cm/ManagedServiceTracker.java
index 3690aa14..2aa96966 100644
--- a/bundles/org.eclipse.equinox.cm/src/org/eclipse/equinox/internal/cm/ManagedServiceTracker.java
+++ b/bundles/org.eclipse.equinox.cm/src/org/eclipse/equinox/internal/cm/ManagedServiceTracker.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2005, 2013 Cognos Incorporated, IBM Corporation and others.
+ * Copyright (c) 2005, 2015 Cognos Incorporated, IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -160,9 +160,7 @@ class ManagedServiceTracker extends ServiceTracker<ManagedService, ManagedServic
if (service == null)
return null;
- synchronized (configurationStore) {
- addReference(reference, service);
- }
+ addReference(reference, service);
return service;
}
@@ -189,16 +187,14 @@ class ManagedServiceTracker extends ServiceTracker<ManagedService, ManagedServic
}
}
}
- synchronized (configurationStore) {
- untrackManagedService(reference);
- addingService(reference);
- }
+
+ untrackManagedService(reference);
+ addingService(reference);
}
public void removedService(ServiceReference<ManagedService> reference, ManagedService service) {
- synchronized (configurationStore) {
- untrackManagedService(reference);
- }
+ untrackManagedService(reference);
+
context.ungetService(reference);
}

Back to the top