private void sendRemoveMemberToOthers(final Address deadAddress) { for (MemberImpl member : lsMembers) { Address address = member.getAddress(); if (!thisAddress.equals(address) && !address.equals(deadAddress)) { sendProcessableTo(new MemberRemover(deadAddress), address); } } }
@Override public void onDisconnect(final Address dead) { if (dead.equals(target)) { removeRemoteCall(getCallId()); setResult(Boolean.FALSE); } }
void doRemoveAddress(Address deadAddress, boolean destroyConnection) { checkServiceThread(); logger.log(Level.INFO, "Removing Address " + deadAddress); if (!node.joined()) { node.failedConnection(deadAddress); return; } if (deadAddress.equals(thisAddress)) return; if (deadAddress.equals(getMasterAddress())) { if (node.joined()) { MemberImpl newMaster = getNextMemberAfter(deadAddress, false, 1); if (newMaster != null) node.setMasterAddress(newMaster.getAddress()); else node.setMasterAddress(null); } else { node.setMasterAddress(null); } logger.log(Level.FINEST, "Now Master " + node.getMasterAddress()); } if (isMaster()) { setJoins.remove(new MemberInfo(deadAddress)); resetMemberMasterConfirmations(); } final Connection conn = node.connectionManager.getConnection(deadAddress); if (destroyConnection && conn != null) { node.connectionManager.destroyConnection(conn); } MemberImpl deadMember = getMember(deadAddress); if (deadMember != null) { removeMember(deadMember); node.getClusterImpl().setMembers(lsMembers); node.concurrentMapManager.syncForDead(deadMember); node.blockingQueueManager.syncForDead(deadAddress); node.listenerManager.syncForDead(deadAddress); node.topicManager.syncForDead(deadAddress); // node.getClusterImpl().setMembers(lsMembers); // shifted up to get members in syncForDead // methods disconnectExistingCalls(deadAddress); if (isMaster()) { logger.log(Level.FINEST, deadAddress + " is dead. Sending remove to all other members."); sendRemoveMemberToOthers(deadAddress); } logger.log(Level.INFO, this.toString()); } }
public void invalidateScheduledActionsFor(Address endpoint, Set<Integer> threadIds) { if (!node.joined() || !node.isActive()) return; if (setScheduledActions.size() > 0) { Iterator<ScheduledAction> it = setScheduledActions.iterator(); while (it.hasNext()) { ScheduledAction sa = it.next(); Request request = sa.getRequest(); if (endpoint.equals(request.caller) && threadIds.contains(request.lockThreadId)) { sa.setValid(false); it.remove(); } } } }
public void handleMaster(Master master) { if (!node.joined() && !thisAddress.equals(master.address)) { logger.log(Level.FINEST, "Handling master response: " + master); final Address currentMaster = node.getMasterAddress(); if (currentMaster != null && !currentMaster.equals(master.address)) { final Connection conn = node.connectionManager.getConnection(currentMaster); if (conn != null && conn.live()) { logger.log( Level.FINEST, "Ignoring master response " + master + " since node has an active master: " + currentMaster); return; } } node.setMasterAddress(master.address); node.connectionManager.getOrConnect(master.address); if (!sendJoinRequest(master.address, true)) { logger.log( Level.WARNING, "Could not create connection to possible master " + master.address); } } }
protected MemberImpl createMember( Address address, NodeType nodeType, String nodeUuid, String ipV6ScopeId) { address.setScopeId(ipV6ScopeId); return new MemberImpl(address, thisAddress.equals(address), nodeType, nodeUuid); }