bug fix for getNewNodes() in ListenerDiscoverer (#3092)

This commit is contained in:
Keuntae Park 2016-06-07 20:02:42 +09:00 committed by Nishant
parent 5a3db634ff
commit e6b32c24ae
2 changed files with 7 additions and 1 deletions

View File

@ -166,7 +166,7 @@ public class ListenerDiscoverer
}
}
);
lastSeenMap = priorSeenMap;
lastSeenMap = currentMap;
return retVal;
}

View File

@ -135,6 +135,12 @@ public class ListenerDiscovererTest extends CuratorTestBase
ImmutableSet.of(HostAndPort.fromString(node.toString())),
listenerDiscoverer.getNodes(listenerKey)
);
// 2nd call of two concurrent getNewNodes should return no entry collection
listenerDiscoverer.getNewNodes(listenerKey);
Assert.assertEquals(
0,
listenerDiscoverer.getNewNodes(listenerKey).size()
);
Assert.assertEquals(
ImmutableSet.of(listenerKey, listenerTier),
ImmutableSet.copyOf(listenerDiscoverer.discoverChildren(null))