SLING-2755 Fixed.
authorIan Boston <ieb@apache.org>
Tue, 26 Feb 2013 05:44:17 +0000 (05:44 +0000)
committerIan Boston <ieb@apache.org>
Tue, 26 Feb 2013 05:44:17 +0000 (05:44 +0000)
git-svn-id: https://svn.apache.org/repos/asf/sling/trunk@1450034 13f79535-47bb-0310-9956-ffa450edef68

src/test/java/org/apache/sling/installer/it/OsgiInstallerTestBase.java

index 8b05b81..9b14218 100644 (file)
@@ -101,9 +101,11 @@ class OsgiInstallerTestBase implements FrameworkListener {
 
     /** Tear down everything. */
     public void tearDown() {
-        if (configAdminTracker != null) {
-            configAdminTracker.close();
-            configAdminTracker = null;
+        synchronized (this) {
+            if (configAdminTracker != null) {
+                configAdminTracker.close();
+                configAdminTracker = null;
+            }
         }
     }
 
@@ -314,12 +316,10 @@ class OsgiInstallerTestBase implements FrameworkListener {
 
     protected ConfigurationAdmin waitForConfigAdmin(final boolean shouldBePresent) {
        ConfigurationAdmin result = null;
-        if (configAdminTracker == null) {
-            synchronized (this) {
-                if (configAdminTracker == null) {
-                    configAdminTracker = new ServiceTracker(bundleContext, ConfigurationAdmin.class.getName(), null);
-                    configAdminTracker.open();
-                }
+        synchronized (this) {
+            if (configAdminTracker == null) {
+                configAdminTracker = new ServiceTracker(bundleContext, ConfigurationAdmin.class.getName(), null);
+                configAdminTracker.open();
             }
         }