Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorThomas Watson2012-03-19 20:29:01 +0000
committerThomas Watson2012-03-19 20:29:01 +0000
commitd484b47054e316cfbfba61e3178cecc24ac1d378 (patch)
treeae8cdd5198d9f3b1659344be16799abc448ff1f6
parent96b97263b06ccef1ee05dd2957592f640bacb94b (diff)
downloadrt.equinox.bundles-d484b47054e316cfbfba61e3178cecc24ac1d378.tar.gz
rt.equinox.bundles-d484b47054e316cfbfba61e3178cecc24ac1d378.tar.xz
rt.equinox.bundles-d484b47054e316cfbfba61e3178cecc24ac1d378.zip
-rw-r--r--bundles/org.eclipse.equinox.cm.test/META-INF/MANIFEST.MF2
-rw-r--r--bundles/org.eclipse.equinox.cm.test/src/org/eclipse/equinox/cm/test/ManagedServiceTest.java46
-rw-r--r--bundles/org.eclipse.equinox.cm/META-INF/MANIFEST.MF2
-rw-r--r--bundles/org.eclipse.equinox.cm/src/org/eclipse/equinox/internal/cm/ManagedServiceTracker.java8
4 files changed, 53 insertions, 5 deletions
diff --git a/bundles/org.eclipse.equinox.cm.test/META-INF/MANIFEST.MF b/bundles/org.eclipse.equinox.cm.test/META-INF/MANIFEST.MF
index a1b9acaab..93f0f5c04 100644
--- a/bundles/org.eclipse.equinox.cm.test/META-INF/MANIFEST.MF
+++ b/bundles/org.eclipse.equinox.cm.test/META-INF/MANIFEST.MF
@@ -5,8 +5,10 @@ Bundle-SymbolicName: org.eclipse.equinox.cm.test
Bundle-Version: 1.0.0
Bundle-Activator: org.eclipse.equinox.cm.test.Activator
Import-Package: junit.framework;version="3.8.1",
+ org.eclipse.equinox.log,
org.osgi.framework;version="1.3.0",
org.osgi.service.cm;version="1.2.0",
org.osgi.service.event;version="1.1.0",
+ org.osgi.service.log;version="1.3.0",
org.osgi.service.packageadmin;version="1.2.0"
Eclipse-LazyStart: true
diff --git a/bundles/org.eclipse.equinox.cm.test/src/org/eclipse/equinox/cm/test/ManagedServiceTest.java b/bundles/org.eclipse.equinox.cm.test/src/org/eclipse/equinox/cm/test/ManagedServiceTest.java
index 2d671c3b7..e1612ed3c 100644
--- a/bundles/org.eclipse.equinox.cm.test/src/org/eclipse/equinox/cm/test/ManagedServiceTest.java
+++ b/bundles/org.eclipse.equinox.cm.test/src/org/eclipse/equinox/cm/test/ManagedServiceTest.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2007, 2010 IBM Corporation and others
+ * Copyright (c) 2007, 2012 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
@@ -13,8 +13,11 @@ package org.eclipse.equinox.cm.test;
import java.util.Dictionary;
import java.util.Properties;
import junit.framework.TestCase;
+import org.eclipse.equinox.log.ExtendedLogReaderService;
+import org.eclipse.equinox.log.LogFilter;
import org.osgi.framework.*;
import org.osgi.service.cm.*;
+import org.osgi.service.log.*;
public class ManagedServiceTest extends TestCase {
@@ -85,6 +88,47 @@ public class ManagedServiceTest extends TestCase {
config.delete();
}
+ public void testBug374637() throws Exception {
+
+ ManagedService ms = new ManagedService() {
+
+ public void updated(Dictionary properties) throws ConfigurationException {
+ // nothing
+ }
+ };
+
+ ExtendedLogReaderService reader = (ExtendedLogReaderService) Activator.getBundleContext().getService(Activator.getBundleContext().getServiceReference(ExtendedLogReaderService.class));
+ synchronized (lock) {
+ locked = false;
+ }
+ LogListener listener = new LogListener() {
+ public void logged(LogEntry entry) {
+ synchronized (lock) {
+ locked = true;
+ lock.notifyAll();
+ }
+ }
+ };
+ reader.addLogListener(listener, new LogFilter() {
+ public boolean isLoggable(Bundle bundle, String loggerName, int logLevel) {
+ return logLevel == LogService.LOG_ERROR;
+ }
+ });
+ Dictionary dict = new Properties();
+ dict.put(Constants.SERVICE_PID, "test");
+ ServiceRegistration reg1 = Activator.getBundleContext().registerService(ManagedService.class.getName(), ms, dict);
+ ServiceRegistration reg2 = Activator.getBundleContext().registerService(ManagedService.class.getName(), ms, dict);
+
+ reg1.unregister();
+ reg2.unregister();
+ reader.removeLogListener(listener);
+
+ synchronized (lock) {
+ lock.wait(1000);
+ assertFalse("Got a error log", locked);
+ }
+ }
+
public void testGeneralManagedService() throws Exception {
updateCount = 0;
ManagedService ms = new ManagedService() {
diff --git a/bundles/org.eclipse.equinox.cm/META-INF/MANIFEST.MF b/bundles/org.eclipse.equinox.cm/META-INF/MANIFEST.MF
index 547f2f85c..5efd2b3f7 100644
--- a/bundles/org.eclipse.equinox.cm/META-INF/MANIFEST.MF
+++ b/bundles/org.eclipse.equinox.cm/META-INF/MANIFEST.MF
@@ -4,7 +4,7 @@ Bundle-Name: %bundleName
Bundle-Vendor: %providerName
Bundle-Localization: plugin
Bundle-SymbolicName: org.eclipse.equinox.cm
-Bundle-Version: 1.0.300.qualifier
+Bundle-Version: 1.0.400.qualifier
Bundle-Activator: org.eclipse.equinox.internal.cm.Activator
Import-Package: org.osgi.framework;version="1.3.0",
org.osgi.service.cm;version="[1.3,1.5)",
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 0148cc092..cf10b6828 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, 2008 Cognos Incorporated, IBM Corporation and others.
+ * Copyright (c) 2005, 2012 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
@@ -93,8 +93,10 @@ class ManagedServiceTracker extends ServiceTracker {
private void add(ServiceReference reference, String pid, ManagedService service) {
ConfigurationImpl config = configurationStore.findConfiguration(pid);
- if (config == null && trackManagedService(pid, reference, service)) {
- asynchUpdated(service, null);
+ if (config == null) {
+ if (trackManagedService(pid, reference, service)) {
+ asynchUpdated(service, null);
+ }
} else {
try {
config.lock();

Back to the top