You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cxf.apache.org by da...@apache.org on 2012/03/09 16:27:48 UTC

svn commit: r1298873 - /cxf/dosgi/trunk/dsw/cxf-dsw/src/main/java/org/apache/cxf/dosgi/dsw/service/ExportRegistrationImpl.java

Author: davidb
Date: Fri Mar  9 15:27:48 2012
New Revision: 1298873

URL: http://svn.apache.org/viewvc?rev=1298873&view=rev
Log:
Fix deadlock.

Modified:
    cxf/dosgi/trunk/dsw/cxf-dsw/src/main/java/org/apache/cxf/dosgi/dsw/service/ExportRegistrationImpl.java

Modified: cxf/dosgi/trunk/dsw/cxf-dsw/src/main/java/org/apache/cxf/dosgi/dsw/service/ExportRegistrationImpl.java
URL: http://svn.apache.org/viewvc/cxf/dosgi/trunk/dsw/cxf-dsw/src/main/java/org/apache/cxf/dosgi/dsw/service/ExportRegistrationImpl.java?rev=1298873&r1=1298872&r2=1298873&view=diff
==============================================================================
--- cxf/dosgi/trunk/dsw/cxf-dsw/src/main/java/org/apache/cxf/dosgi/dsw/service/ExportRegistrationImpl.java (original)
+++ cxf/dosgi/trunk/dsw/cxf-dsw/src/main/java/org/apache/cxf/dosgi/dsw/service/ExportRegistrationImpl.java Fri Mar  9 15:27:48 2012
@@ -49,7 +49,7 @@ public class ExportRegistrationImpl impl
     private Throwable exception = null;
 
     private ExportRegistrationImpl parent = null;
-    private int instanceCount = 1;
+    private volatile int instanceCount = 1;
 
     private RemoteServiceAdminCore rsaCore;
 
@@ -68,7 +68,7 @@ public class ExportRegistrationImpl impl
         parent.instanceAdded();
     }
 
-    private synchronized void instanceAdded() {
+    private void instanceAdded() {
         ++instanceCount;
     }
 
@@ -93,7 +93,7 @@ public class ExportRegistrationImpl impl
         }
     }
 
-    private synchronized void instanceClosed() {
+    private void instanceClosed() {
         --instanceCount;
         if (instanceCount <= 0) {
             // really close the ExReg
@@ -101,11 +101,12 @@ public class ExportRegistrationImpl impl
 
             LOG.fine("really closing ExportRegistartion now! ");
 
-
-
-            if (server != null) {
-                // FIXME: is this done like this ?
-                server.stop();
+            synchronized (this) {
+                if (server != null) {
+                    // FIXME: is this done like this ?
+                    server.stop();
+                    server = null;
+                }
             }
         }
     }