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

    https://github.com/apache/incubator-brooklyn/pull/935#discussion_r41282853
  
    --- Diff: 
core/src/test/java/org/apache/brooklyn/entity/group/DynamicGroupTest.java ---
    @@ -476,18 +473,24 @@ public void 
testDoesNotDeadlockOnUnmanageWhileOtherMemberBeingAdded() throws Exc
             final List<Entity> membersAdded = new 
CopyOnWriteArrayList<Entity>();
             
             final DynamicGroupImpl group2 = new DynamicGroupImpl() {
    -            @Override
    -            public <T> void emit(Sensor<T> sensor, T val) {
    -                // intercept inside AbstractGroup.addMember, while it 
still holds lock on members
    -                if (sensor == AbstractGroup.MEMBER_ADDED && 
addingMemberDoLatching.get()) {
    -                    addingMemberReachedLatch.countDown();
    -                    try {
    -                        addingMemberContinueLatch.await();
    -                    } catch (InterruptedException e) {
    -                        throw Exceptions.propagate(e);
    +            private final BasicSensorSupport interceptedSensors = new 
BasicSensorSupport() {
    +                @Override
    +                public <T> void emit(Sensor<T> sensor, T val) {
    +                    // intercept inside AbstractGroup.addMember, while it 
still holds lock on members
    +                    if (sensor == AbstractGroup.MEMBER_ADDED && 
addingMemberDoLatching.get()) {
    +                        addingMemberReachedLatch.countDown();
    +                        try {
    +                            addingMemberContinueLatch.await();
    +                        } catch (InterruptedException e) {
    +                            throw Exceptions.propagate(e);
    +                        }
                         }
    +                    super.emit(sensor, val);
                     }
    -                super.emit(sensor, val);
    +            };
    +            @Override
    +            public BasicSensorSupport sensors() {
    +                return interceptedSensors;
    --- End diff --
    
    Good catch!


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