Github user aledsage commented on a diff in the pull request:

    https://github.com/apache/brooklyn-server/pull/454#discussion_r89661014
  
    --- Diff: 
core/src/main/java/org/apache/brooklyn/core/mgmt/internal/LocalEntityManager.java
 ---
    @@ -742,7 +742,7 @@ private boolean unmanageNonRecursive(Entity e) {
                 if (e instanceof Group) {
                     Collection<Entity> members = ((Group)e).getMembers();
                     for (Entity member : members) {
    -                    if (!Entities.isNoLongerManaged(member)) 
member.removeGroup((Group)e);
    +                    if (!Entities.isNoLongerManaged(member)) 
((EntityInternal)member).groups().remove((Group)e);
    --- End diff --
    
    @geomacy I don't think so. These are each very special cases:
    * `LocalEntityManager.unmanageNonRecursive()` is handling the case where 
the group has been unmanaged - updating each of the members to ensure they know 
they are no longer in that group. We don't want to start calling other methods 
on `group` (triggering a bunch of events) because this entity is in the process 
of being unmanaged.
    * `AbstractGroupImpl`'s calls are the implementation of 
`addMember`/`removeMember`, so they definitely need to call the 
`member.addGroup()`.
    * `GroupTest. testAddingUnmanagedGroupDoesNotFailBadly()` is trying to add 
an unmanaged group to ensure that doesn't break things (so we couldn't call 
`group.addMember()`).



---
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.
---

Reply via email to