private synchronized void nodeAdded(final String nodeID) { addHaInfoIfLost(); // This is not ideal but we need to wait for the group information to appear - and this will be shortly // after the node has been added checkQuorumWhenAdded(nodeID, System.currentTimeMillis()); }
private synchronized void nodeLeft(String leftNodeID) { addHaInfoIfLost(); checkQuorum(); if (attainedQuorum) { checkSubs(leftNodeID); // Check for failover String sclusterInfo = clusterMap.get(leftNodeID); if (sclusterInfo == null) { // Clean close - do nothing } else { JsonObject clusterInfo = new JsonObject(sclusterInfo); checkFailover(leftNodeID, clusterInfo); } // We also check for and potentially resume any previous failovers that might have failed // We can determine this if there any ids in the cluster map which aren't in the node list List<String> nodes = clusterManager.getNodes(); for (Map.Entry<String, String> entry: clusterMap.entrySet()) { if (!leftNodeID.equals(entry.getKey()) && !nodes.contains(entry.getKey())) { JsonObject haInfo = new JsonObject(entry.getValue()); checkFailover(entry.getKey(), haInfo); } } } }
private synchronized void nodeAdded(final String nodeID) { addHaInfoIfLost(); // This is not ideal but we need to wait for the group information to appear - and this will be shortly // after the node has been added checkQuorumWhenAdded(nodeID, System.currentTimeMillis()); }
private synchronized void nodeLeft(String leftNodeID) { addHaInfoIfLost(); checkQuorum(); if (attainedQuorum) { checkSubs(leftNodeID); // Check for failover String sclusterInfo = clusterMap.get(leftNodeID); if (sclusterInfo == null) { // Clean close - do nothing } else { JsonObject clusterInfo = new JsonObject(sclusterInfo); checkFailover(leftNodeID, clusterInfo); } // We also check for and potentially resume any previous failovers that might have failed // We can determine this if there any ids in the cluster map which aren't in the node list List<String> nodes = clusterManager.getNodes(); for (Map.Entry<String, String> entry: clusterMap.entrySet()) { if (!leftNodeID.equals(entry.getKey()) && !nodes.contains(entry.getKey())) { JsonObject haInfo = new JsonObject(entry.getValue()); checkFailover(entry.getKey(), haInfo); } } } }