brooklyn-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From aledsage <...@git.apache.org>
Subject [GitHub] incubator-brooklyn pull request: Return null SubscriptionContext w...
Date Fri, 09 Jan 2015 09:45:53 GMT
Github user aledsage commented on a diff in the pull request:

    https://github.com/apache/incubator-brooklyn/pull/394#discussion_r22707761
  
    --- Diff: core/src/main/java/brooklyn/management/internal/NonDeploymentManagementContext.java
---
    @@ -227,8 +227,7 @@ public QueueingSubscriptionManager getSubscriptionManager() {
         @Override
         public synchronized SubscriptionContext getSubscriptionContext(Entity entity) {
             if (!this.entity.equals(entity)) throw new IllegalStateException("Non-deployment
context "+this+" can only use a single Entity: has "+this.entity+", but passed "+entity);
    -        if (mode==NonDeploymentManagementContextMode.MANAGEMENT_STOPPED)
    -            throw new IllegalStateException("Entity "+entity+" is no longer managed;
subscription context not available");
    +        if (mode==NonDeploymentManagementContextMode.MANAGEMENT_STOPPED) return null;
    --- End diff --
    
    I think I'd prefer that we return a `NonDeploymentSubscriptionContext`. That could throw
exceptions on any attempt to subscribe etc, and would just `return false` for unsubscribe.
I don't like having lots of null checks in the calling code.


---
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 infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

Mime
View raw message