use of org.neo4j.helpers.collection.FilteringIterable in project neo4j by neo4j.
the class DisconnectLeaderScenario method oneIteration.
private long oneIteration(long leaderStabilityMaxTimeMillis) throws InterruptedException, TimeoutException {
List<RaftMachine> rafts = fixture.rafts.stream().map(Fixture.RaftFixture::raftMachine).collect(toList());
MemberId oldLeader = ElectionUtil.waitForLeaderAgreement(rafts, leaderStabilityMaxTimeMillis);
long startTime = System.currentTimeMillis();
fixture.net.disconnect(oldLeader);
MemberId newLeader = ElectionUtil.waitForLeaderAgreement(new FilteringIterable<>(rafts, raft -> !raft.identity().equals(oldLeader)), leaderStabilityMaxTimeMillis);
// this should be guaranteed by the waitForLeaderAgreement call
assert !newLeader.equals(oldLeader);
return System.currentTimeMillis() - startTime;
}
Aggregations