use of org.apache.ignite.spi.discovery.tcp.internal.TcpDiscoveryStatistics in project ignite by apache.
the class TcpDiscoverySelfTest method testNoExtraNodeFailedMessage.
/**
* @throws Exception If failed.
*/
public void testNoExtraNodeFailedMessage() throws Exception {
try {
final int NODES = 10;
startGridsMultiThreaded(NODES);
int stopIdx = 5;
Ignite failIgnite = ignite(stopIdx);
((TcpDiscoverySpi) failIgnite.configuration().getDiscoverySpi()).simulateNodeFailure();
for (int i = 0; i < NODES; i++) {
if (i != stopIdx) {
final Ignite ignite = ignite(i);
GridTestUtils.waitForCondition(new PA() {
@Override
public boolean apply() {
return ignite.cluster().topologyVersion() >= NODES + 1;
}
}, 10_000);
TcpDiscoverySpi spi = (TcpDiscoverySpi) ignite.configuration().getDiscoverySpi();
TcpDiscoveryStatistics stats = GridTestUtils.getFieldValue(spi, "stats");
Integer cnt = stats.sentMessages().get(TcpDiscoveryNodeFailedMessage.class.getSimpleName());
log.info("Count1: " + cnt);
assertTrue("Invalid message count: " + cnt, cnt == null || cnt <= 2);
cnt = stats.receivedMessages().get(TcpDiscoveryNodeFailedMessage.class.getSimpleName());
log.info("Count2: " + cnt);
assertTrue("Invalid message count: " + cnt, cnt == null || cnt <= 2);
}
}
} finally {
stopAllGrids();
}
}
Aggregations