Source:
public void testNodeExclusion() throws Exception { int srvCnt = 2; IgniteEx grid0 = (IgniteEx)startGrids(srvCnt); IgniteEx client = null; try { Ignition.setClientMode(true); client = startGrid(srvCnt); } finally { Ignition.setClientMode(false); } MBeanServer srv = ManagementFactory.getPlatformMBeanServer(); ObjectName spiName = U.makeMBeanName(grid0.context().igniteInstanceName(), "SPIs", TcpDiscoverySpi.class.getSimpleName()); TcpDiscoverySpiMBean bean = JMX.newMBeanProxy(srv, spiName, TcpDiscoverySpiMBean.class); assertEquals(grid0.cluster().forServers().nodes().size(), srvCnt); assertEquals(grid0.cluster().forClients().nodes().size(), 1); bean.excludeNode(client.localNode().id().toString()); assertTrue(GridTestUtils.waitForCondition(() -> grid0.cluster().forClients().nodes().isEmpty(), 5_000)); assertTrue(strLog.toString().contains("Node failed through JMX interface")); assertEquals(grid0.cluster().forClients().nodes().size(), 0); bean.excludeNode(new UUID(0, 0).toString()); bean.excludeNode("fakeUUID"); assertEquals(grid0.cluster().forServers().nodes().size(), srvCnt); ClusterNode node = grid0.cluster().forServers().nodes().stream().filter(n -> n.id() != grid0.localNode().id()) .findFirst().get(); assertNotNull(node); bean.excludeNode(node.id().toString()); assertTrue(GridTestUtils.waitForCondition(() -> grid0.cluster().forServers().nodes().size() == srvCnt - 1, 5_000)); }

Target:
public void testNodeExclusion() throws Exception { int srvCnt = 2; IgniteEx grid0 = (IgniteEx)startGrids(srvCnt); IgniteEx client; client = startGrid("client"); MBeanServer srv = ManagementFactory.getPlatformMBeanServer(); ObjectName spiName = U.makeMBeanName(grid0.context().igniteInstanceName(), "SPIs", TcpDiscoverySpi.class.getSimpleName()); TcpDiscoverySpiMBean bean = JMX.newMBeanProxy(srv, spiName, TcpDiscoverySpiMBean.class); assertEquals(grid0.cluster().forServers().nodes().size(), srvCnt); assertEquals(grid0.cluster().forClients().nodes().size(), 1); UUID clientId = client.localNode().id(); bean.excludeNode(clientId.toString()); assertTrue(GridTestUtils.waitForCondition(() -> grid0.cluster().forClients().nodes().size() == 1, 5_000)); assertTrue(GridTestUtils.waitForCondition(() -> grid0.cluster().forClients().node(clientId) == null, 5_000)); assertTrue(strLog.toString().contains("Node excluded, node=")); bean.excludeNode(new UUID(0, 0).toString()); bean.excludeNode("fakeUUID"); assertEquals(grid0.cluster().forServers().nodes().size(), srvCnt); ClusterNode node = grid0.cluster().forServers().nodes().stream().filter(n -> n.id() != grid0.localNode().id()) .findFirst().get(); assertNotNull(node); final CountDownLatch cnt = new CountDownLatch(1); Ignite segmentedNode = G.allGrids().stream().filter(id -> id.cluster().localNode().id().equals(node.id())) .findAny().get(); assertNotNull(segmentedNode); segmentedNode.events().localListen(new IgnitePredicate<Event>() { @Override public boolean apply(Event evt) { cnt.countDown(); return false; } }, EVT_NODE_SEGMENTED); bean.excludeNode(node.id().toString()); assertTrue(GridTestUtils.waitForCondition(() -> grid0.cluster().forServers().nodes().size() == srvCnt - 1, 5_000)); assertTrue("Next node have to be failed within failureDetectionTimeout", cnt.await(grid0.configuration().getFailureDetectionTimeout() + 3000, MILLISECONDS)); bean.excludeNode(grid0.localNode().id().toString()); }