brooklyn-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From henev...@apache.org
Subject [1/6] incubator-brooklyn git commit: prevent deadlock if requests coming in during startup
Date Thu, 21 Jan 2016 01:23:28 GMT
Repository: incubator-brooklyn
Updated Branches:
  refs/heads/master 8303fea86 -> 511886099


prevent deadlock if requests coming in during startup


Project: http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/commit/2354c486
Tree: http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/tree/2354c486
Diff: http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/diff/2354c486

Branch: refs/heads/master
Commit: 2354c4867bc8de3e80bef200bf51424696a33dfc
Parents: 2a432cf
Author: Alex Heneveld <alex.heneveld@cloudsoftcorp.com>
Authored: Wed Jan 20 18:13:35 2016 +0000
Committer: Alex Heneveld <alex.heneveld@cloudsoftcorp.com>
Committed: Wed Jan 20 21:07:12 2016 +0000

----------------------------------------------------------------------
 .../core/mgmt/internal/AbstractManagementContext.java    | 11 ++++++++---
 1 file changed, 8 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/2354c486/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/mgmt/internal/AbstractManagementContext.java
----------------------------------------------------------------------
diff --git a/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/mgmt/internal/AbstractManagementContext.java
b/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/mgmt/internal/AbstractManagementContext.java
index d41e059..5d07ed6 100644
--- a/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/mgmt/internal/AbstractManagementContext.java
+++ b/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/mgmt/internal/AbstractManagementContext.java
@@ -372,10 +372,15 @@ public abstract class AbstractManagementContext implements ManagementContextInte
         return configMap;
     }
 
+    private Object locationRegistrySemaphore = new Object();
+    
     @Override
-    public synchronized LocationRegistry getLocationRegistry() {
-        if (locationRegistry==null) locationRegistry = new BasicLocationRegistry(this);
-        return locationRegistry;
+    public LocationRegistry getLocationRegistry() {
+        // NB: can deadlock if synched on whole LMC
+        synchronized (locationRegistrySemaphore) {
+            if (locationRegistry==null) locationRegistry = new BasicLocationRegistry(this);
+            return locationRegistry;
+        }
     }
 
     @Override


Mime
View raw message