You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@brooklyn.apache.org by he...@apache.org on 2016/04/01 16:28:16 UTC
[4/5] brooklyn-server git commit: Entity.getSubscriptionTracker
synchronization
Entity.getSubscriptionTracker synchronization
Avoid calling getSubscriptionContext() while holding lock on
AbstractEntity.this. See discussion in https://github.com/apache/brooklyn-server/pull/96
Project: http://git-wip-us.apache.org/repos/asf/brooklyn-server/repo
Commit: http://git-wip-us.apache.org/repos/asf/brooklyn-server/commit/ea762bb1
Tree: http://git-wip-us.apache.org/repos/asf/brooklyn-server/tree/ea762bb1
Diff: http://git-wip-us.apache.org/repos/asf/brooklyn-server/diff/ea762bb1
Branch: refs/heads/0.9.0
Commit: ea762bb15d7c9652c5cf13f6efd13bb00ae28487
Parents: c2c1484
Author: Aled Sage <al...@gmail.com>
Authored: Fri Apr 1 12:32:39 2016 +0100
Committer: Alex Heneveld <al...@cloudsoftcorp.com>
Committed: Fri Apr 1 15:27:52 2016 +0100
----------------------------------------------------------------------
.../java/org/apache/brooklyn/core/entity/AbstractEntity.java | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/ea762bb1/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 09834af..58767e4 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
@@ -1492,9 +1492,13 @@ public abstract class AbstractEntity extends AbstractBrooklynObject implements E
}
protected SubscriptionTracker getSubscriptionTracker() {
+ // TODO Would be nice to simplify concurrent model, and not synchronize on
+ // AbstractEntity.this; perhaps could get rid of lazy-initialisation, but then
+ // would need to first ensure `managementSupport` is definitely initialised.
+ SubscriptionContext subscriptionContext = getSubscriptionContext();
synchronized (AbstractEntity.this) {
if (_subscriptionTracker == null) {
- _subscriptionTracker = new SubscriptionTracker(getSubscriptionContext());
+ _subscriptionTracker = new SubscriptionTracker(subscriptionContext);
}
return _subscriptionTracker;
}