continue; if (i == j || ctx.connectionAvailable(node, to)) connections[i].set(j);
/** * Finds set of the client nodes which are able to connect to given set of server nodes {@code srvNodesSet}. * * @param ctx Communication failure context. * @param srvNodesSet Server nodes set. * @return Set of client nodes. */ private Set<ClusterNode> findConnectedClients(CommunicationFailureContext ctx, BitSet srvNodesSet) { Set<ClusterNode> connectedClients = new HashSet<>(); List<ClusterNode> allNodes = ctx.topologySnapshot(); for (ClusterNode node : allNodes) { if (!node.isClient()) continue; boolean hasConnections = true; Iterator<Integer> it = new BitSetIterator(srvNodesSet); while (it.hasNext()) { int srvNodeIdx = it.next(); ClusterNode srvNode = allNodes.get(srvNodeIdx); if (!ctx.connectionAvailable(node, srvNode) || !ctx.connectionAvailable(srvNode, node)) { hasConnections = false; break; } } if (hasConnections) connectedClients.add(node); } return connectedClients; }
continue; if (i == j || ctx.connectionAvailable(node, to)) connections[i].set(j);
/** * Finds set of the client nodes which are able to connect to given set of server nodes {@code srvNodesSet}. * * @param ctx Communication failure context. * @param srvNodesSet Server nodes set. * @return Set of client nodes. */ private Set<ClusterNode> findConnectedClients(CommunicationFailureContext ctx, BitSet srvNodesSet) { Set<ClusterNode> connectedClients = new HashSet<>(); List<ClusterNode> allNodes = ctx.topologySnapshot(); for (ClusterNode node : allNodes) { if (!node.isClient()) continue; boolean hasConnections = true; Iterator<Integer> it = new BitSetIterator(srvNodesSet); while (it.hasNext()) { int srvNodeIdx = it.next(); ClusterNode srvNode = allNodes.get(srvNodeIdx); if (!ctx.connectionAvailable(node, srvNode) || !ctx.connectionAvailable(srvNode, node)) { hasConnections = false; break; } } if (hasConnections) connectedClients.add(node); } return connectedClients; }