Search in sources :

Example 1 with Util

use of org.jgroups.util.Util in project JGroups by belaban.

the class BaseLeaveTest method testSequentialLeavesOfCoordinators.

/**
 * The first N coords leave, one after the other
 */
public void testSequentialLeavesOfCoordinators() throws Exception {
    setup(NUM);
    Arrays.stream(channels, 0, channels.length / 2).forEach(Util::close);
    Util.waitUntilAllChannelsHaveSameView(5000, 1000, Arrays.stream(channels, channels.length / 2, channels.length).collect(Collectors.toList()));
    Arrays.stream(channels, 0, channels.length).forEach(ch -> {
        if (ch.isConnected())
            System.out.printf("%s: %s\n", ch.getAddress(), ch.getView());
    });
    Address coord = channels[channels.length / 2].getAddress();
    System.out.printf("-- new coord is %s\n", coord);
    assert Arrays.stream(channels, channels.length / 2, channels.length).allMatch(ch -> ch.getView().size() == channels.length / 2 && ch.getView().getCoord().equals(coord));
}
Also used : Address(org.jgroups.Address) Util(org.jgroups.util.Util)

Aggregations

Address (org.jgroups.Address)1 Util (org.jgroups.util.Util)1