Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorThomas Watson2015-11-06 20:37:01 +0000
committerThomas Watson2015-11-06 20:37:01 +0000
commit9e00a26146072855a4ba1abf7bb53dea3d2cacdb (patch)
tree088a7b9f86e12199f7dc54e7c7cd877c99fe0585 /bundles/org.eclipse.equinox.cm/src
parented6bd715c652c830f9eac4c9c2cd8e39e5f974a1 (diff)
downloadrt.equinox.bundles-9e00a26146072855a4ba1abf7bb53dea3d2cacdb.tar.gz
rt.equinox.bundles-9e00a26146072855a4ba1abf7bb53dea3d2cacdb.tar.xz
rt.equinox.bundles-9e00a26146072855a4ba1abf7bb53dea3d2cacdb.zip
Revert "Bug 459004 - Deadlock in configuration admin when using OSGi DS"
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, 26 insertions, 21 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 68b0f715..ce86b6c8 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,16 +183,13 @@ class ConfigurationStore {
return configurations.get(pid);
}
- public ConfigurationImpl[] getFactoryConfigurations(String factoryPid) {
+ public synchronized ConfigurationImpl[] getFactoryConfigurations(String factoryPid) {
List<ConfigurationImpl> resultList = new ArrayList<ConfigurationImpl>();
- synchronized (this) {
- resultList.addAll(configurations.values());
- }
- for (Iterator<ConfigurationImpl> it = resultList.iterator(); it.hasNext();) {
+ for (Iterator<ConfigurationImpl> it = configurations.values().iterator(); it.hasNext();) {
ConfigurationImpl config = it.next();
String otherFactoryPid = config.getFactoryPid();
- if (otherFactoryPid == null || !otherFactoryPid.equals(factoryPid))
- it.remove();
+ if (otherFactoryPid != null && otherFactoryPid.equals(factoryPid))
+ resultList.add(config);
}
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 af93f1ac..5506b7ff 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, 2015 Cognos Incorporated, IBM Corporation and others.
+ * Copyright (c) 2005, 2013 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,7 +151,9 @@ class ManagedServiceFactoryTracker extends ServiceTracker<ManagedServiceFactory,
if (service == null)
return null;
- addReference(reference, service);
+ synchronized (configurationStore) {
+ addReference(reference, service);
+ }
return service;
}
@@ -178,14 +180,16 @@ class ManagedServiceFactoryTracker extends ServiceTracker<ManagedServiceFactory,
}
}
}
-
- untrackManagedServiceFactory(reference);
- addingService(reference);
+ synchronized (configurationStore) {
+ untrackManagedServiceFactory(reference);
+ addingService(reference);
+ }
}
public void removedService(ServiceReference<ManagedServiceFactory> reference, ManagedServiceFactory service) {
- untrackManagedServiceFactory(reference);
-
+ synchronized (configurationStore) {
+ 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 2aa96966..3690aa14 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, 2015 Cognos Incorporated, IBM Corporation and others.
+ * Copyright (c) 2005, 2013 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,7 +160,9 @@ class ManagedServiceTracker extends ServiceTracker<ManagedService, ManagedServic
if (service == null)
return null;
- addReference(reference, service);
+ synchronized (configurationStore) {
+ addReference(reference, service);
+ }
return service;
}
@@ -187,14 +189,16 @@ class ManagedServiceTracker extends ServiceTracker<ManagedService, ManagedServic
}
}
}
-
- untrackManagedService(reference);
- addingService(reference);
+ synchronized (configurationStore) {
+ untrackManagedService(reference);
+ addingService(reference);
+ }
}
public void removedService(ServiceReference<ManagedService> reference, ManagedService service) {
- untrackManagedService(reference);
-
+ synchronized (configurationStore) {
+ untrackManagedService(reference);
+ }
context.ungetService(reference);
}

Back to the top