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 checkQuorumWhenAdded(final String nodeID, final long start) { if (clusterMap.containsKey(nodeID)) { checkQuorum(); if (attainedQuorum) { checkSubs(nodeID); } } else { vertx.setTimer(200, tid -> { // This can block on a monitor so it needs to run as a worker vertx.executeBlockingInternal(fut -> { if (System.currentTimeMillis() - start > 10000) { log.warn("Timed out waiting for group information to appear"); } else if (!stopped) { ContextInternal context = vertx.getContext(); try { // Remove any context we have here (from the timer) otherwise will screw things up when verticles are deployed ContextImpl.setContext(null); checkQuorumWhenAdded(nodeID, start); } finally { ContextImpl.setContext((ContextImpl) context); } } fut.complete(); }, null); }); } }
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 checkQuorumWhenAdded(final String nodeID, final long start) { if (clusterMap.containsKey(nodeID)) { checkQuorum(); if (attainedQuorum) { checkSubs(nodeID); } } else { vertx.setTimer(200, tid -> { // This can block on a monitor so it needs to run as a worker vertx.executeBlockingInternal(fut -> { if (System.currentTimeMillis() - start > 10000) { log.warn("Timed out waiting for group information to appear"); } else if (!stopped) { ContextInternal context = vertx.getContext(); try { // Remove any context we have here (from the timer) otherwise will screw things up when verticles are deployed ContextImpl.setContext(null); checkQuorumWhenAdded(nodeID, start); } finally { ContextImpl.setContext((ContextImpl) context); } } fut.complete(); }, null); }); } }