Github user ahgittin commented on the pull request:
https://github.com/apache/incubator-brooklyn/pull/394#issuecomment-103071728
With this isn't it likely that when an entity is stopped someone might get
the subscription manager populated with a non-deployment context where the
`initialManagementContext` is the original context? And so calls to
`subscribe` and `unsubscribe` will do something when we don't want them to?
Granted the code here has grown to be unwieldy -- the original intention
was to allow a queuing context before the node is managed, which comes to life
on management. But removing fail-fast behaviour doesn't seem like a good idea
-- apart from for `unsubscribe` where it seems fine.
Does it make sense to change `isInitialManagementContextReal()` to
`isInitialManagementContextUsable()` and in there put a check `if
(mode==NonDeploymentManagementContextMode.MANAGEMENT_STOPPED) return false;` ?
And I think you're right, we should also guard `getSubscriptionManger()`
with a `STOPPED` check, throwing or returning a non-deployment.
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---