Пример #1
0
  private void removeMember(MemberImpl deadMember) {
    logger.info("Removing " + deadMember);
    lock.lock();
    try {
      Map<Address, MemberImpl> members = membersMapRef.get();
      final Address deadAddress = deadMember.getAddress();

      if (members.containsKey(deadAddress)) {
        // !!! ORDERED !!!
        Map<Address, MemberImpl> newMembers = new LinkedHashMap<Address, MemberImpl>(members);
        newMembers.remove(deadAddress);
        clusterHeartbeatManager.removeMember(deadMember);
        setMembersRef(newMembers);

        if (node.isMaster()) {
          if (logger.isFinestEnabled()) {
            logger.finest(deadMember + " is dead, sending remove to all other members...");
          }
          invokeMemberRemoveOperation(deadAddress);
        }

        final ClusterState clusterState = clusterStateManager.getState();
        if (clusterState == ClusterState.FROZEN || clusterState == ClusterState.PASSIVE) {
          if (logger.isFinestEnabled()) {
            logger.finest(
                deadMember
                    + " is dead, added to members left while cluster is "
                    + clusterState
                    + " state");
          }
          Map<Address, MemberImpl> membersRemovedInNotActiveState =
              new LinkedHashMap<Address, MemberImpl>(membersRemovedInNotActiveStateRef.get());
          membersRemovedInNotActiveState.put(deadAddress, deadMember);
          membersRemovedInNotActiveStateRef.set(
              Collections.unmodifiableMap(membersRemovedInNotActiveState));
          final InternalPartitionServiceImpl partitionService = node.partitionService;
          partitionService.cancelReplicaSyncRequestsTo(deadAddress);
        } else {
          onMemberRemove(deadMember, newMembers);
        }

        // async events
        sendMembershipEventNotifications(
            deadMember, unmodifiableSet(new LinkedHashSet<Member>(newMembers.values())), false);
      }
    } finally {
      lock.unlock();
    }
  }
Пример #2
0
 public void sendShutdownMessage() {
   invokeMemberRemoveOperation(thisAddress);
 }