brooklyn-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From henev...@apache.org
Subject [1/4] brooklyn-server git commit: BROOKLYN-245: improve synchronization in entity
Date Fri, 01 Apr 2016 14:22:19 GMT
Repository: brooklyn-server
Updated Branches:
  refs/heads/master 797ed8f26 -> 9720743a2


BROOKLYN-245: improve synchronization in entity

Project: http://git-wip-us.apache.org/repos/asf/brooklyn-server/repo
Commit: http://git-wip-us.apache.org/repos/asf/brooklyn-server/commit/24aa5ddd
Tree: http://git-wip-us.apache.org/repos/asf/brooklyn-server/tree/24aa5ddd
Diff: http://git-wip-us.apache.org/repos/asf/brooklyn-server/diff/24aa5ddd

Branch: refs/heads/master
Commit: 24aa5dddd87e5b20ed7e43f817be9355d0b198bd
Parents: cf305e2
Author: Aled Sage <aled.sage@gmail.com>
Authored: Thu Mar 31 20:46:58 2016 +0100
Committer: Aled Sage <aled.sage@gmail.com>
Committed: Thu Mar 31 20:46:58 2016 +0100

----------------------------------------------------------------------
 .../org/apache/brooklyn/core/entity/AbstractEntity.java   | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/24aa5ddd/core/src/main/java/org/apache/brooklyn/core/entity/AbstractEntity.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/brooklyn/core/entity/AbstractEntity.java b/core/src/main/java/org/apache/brooklyn/core/entity/AbstractEntity.java
index 1406855..09834af 100644
--- a/core/src/main/java/org/apache/brooklyn/core/entity/AbstractEntity.java
+++ b/core/src/main/java/org/apache/brooklyn/core/entity/AbstractEntity.java
@@ -1484,9 +1484,11 @@ public abstract class AbstractEntity extends AbstractBrooklynObject
implements E
         }
         
         protected SubscriptionContext getSubscriptionContext() {
-            synchronized (AbstractEntity.this) {
-                return getManagementSupport().getSubscriptionContext();
-            }
+            // Rely on synchronization in EntityManagementSupport; synchronizing on AbstractEntity.this
+            // is dangerous because user's entity code might synchronize on that and call
getAttribute.
+            // Given that getSubscriptionContext is called by AttributeMap.update (via emitInternal),
+            // that risks deadlock!
+            return getManagementSupport().getSubscriptionContext();
         }
 
         protected SubscriptionTracker getSubscriptionTracker() {
@@ -1548,7 +1550,7 @@ public abstract class AbstractEntity extends AbstractBrooklynObject
implements E
      * @deprecated since 0.9.0; for internal use only
      */
     @Deprecated
-    protected synchronized SubscriptionTracker getSubscriptionTracker() {
+    protected SubscriptionTracker getSubscriptionTracker() {
         return subscriptions().getSubscriptionTracker();
     }
     


Mime
View raw message