Skip to content

Commit

Permalink
Entity.getSubscriptionTracker synchronization
Browse files Browse the repository at this point in the history
Avoid calling getSubscriptionContext() while holding lock on 
AbstractEntity.this. See discussion in #96
  • Loading branch information
aledsage authored and ahgittin committed Apr 1, 2016
1 parent c2c1484 commit ea762bb
Showing 1 changed file with 5 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -1492,9 +1492,13 @@ protected SubscriptionContext getSubscriptionContext() {
}

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;
}
Expand Down

0 comments on commit ea762bb

Please sign in to comment.