Handles a synchronize request from a peer.

@param member the peer from which to handle the request
172673
private Collection<ImmutableMember> handleSync(ImmutableMember member) {
    updateState(member);
    return new ArrayList<>(members.values().stream().map(SwimMember::copy).collect(Collectors.toList()));
  }
167320
protected void handleAppendResponseFailure(MemberState member, AppendRequest request, Throwable error) {
    // Trigger commit futures if necessary.
    updateHeartbeatTime(member, error);

    super.handleAppendResponseFailure(member, request, error);
  }
1310705
private void handleJoinEvent(Node node) {
    GossipMember member = new GossipMember(MemberId.from(node.id().id()), node.address());
    if (!members.containsKey(member.id())) {
      sendHeartbeat(member);
    }
  }
802354
public void removeMember(AsteriskQueueMemberImpl member)
    {
        synchronized (members)
        {
            // Check if member exists
            if (!members.containsValue(member))
            {
                return;
            }
            // If so, remove the member.
            logger.info("Remove member from the queue " + getName() + ": "
                    + member.toString());
            members.remove(member.getLocation());
        }

        fireMemberRemoved(member);
    }
835800
protected void sync(AbstractByteArrayBufferBuffer master) {

    this.buffersEndIndex = master.buffersEndIndex;
    int bufferDist = master.bufferStepCount - this.bufferStepCount;
    if (bufferDist > 0) {
      this.buffersIndex = master.buffersIndex;
      this.bufferStepCount = master.bufferStepCount;
      ByteArrayBuffer buffer = this.buffers[this.buffersIndex];
      this.currentBufferBytes = buffer.getBytes();
      this.currentBufferIndex = buffer.getCurrentIndex();
      this.currentBufferMax = buffer.getMaximumIndex();
    }
  }
939725
public void synchronize(DefaultTreeModel treeModel, Tree<E> tree) throws IOException, SQLException {
		assert SwingUtilities.isEventDispatchThread() : ApplicationResources.accessor.getMessage("assert.notRunningInSwingEventThread");
		synchronize(treeModel, tree.getRootNodes());
	}
77619
protected void synchronizeGroupMembersOnDelete(IEntityGroup group) throws GroupsException {
        GroupMemberImpl gmi = null;

        for (Iterator it = group.getChildren().iterator(); it.hasNext(); ) {
            gmi = (GroupMemberImpl) it.next();
            gmi.invalidateInParentGroupsCache(Collections.singleton((IGroupMember) gmi));
            if (cacheInUse()) {
                cacheUpdate(gmi);
            }
        }
    }
1208055
private void putInCache(MembershipImpl membership)
   {
      cache.put(cache.getMembershipKey(membership), membership, CacheType.MEMBERSHIP);
   }
530874
private void probe(ImmutableMember member) {
    LOGGER.trace("{} - Probing {}", localMember.id(), member);
    bootstrapService.getMessagingService().sendAndReceive(
        member.address(), MEMBERSHIP_PROBE, SERIALIZER.encode(Pair.of(localMember.copy(), member)), false, config.getProbeTimeout())
        .whenCompleteAsync((response, error) -> {
          if (error == null) {
            updateState(SERIALIZER.decode(response));
          } else {
            LOGGER.debug("{} - Failed to probe {}", this.localMember.id(), member, error);
            // Verify that the local member term has not changed and request probes from peers.
            SwimMember swimMember = members.get(member.id());
            if (swimMember != null && swimMember.getIncarnationNumber() == member.incarnationNumber()) {
              requestProbes(swimMember.copy());
            }
          }
        }, swimScheduler);
  }
32182
void addMember(AsteriskQueueMemberImpl member)
    {
        synchronized (members)
        {
            // Check if member already exists
            if (members.containsValue(member))
            {
                return;
            }
            // If not, add the new member.
            logger.info("Adding new member to the queue " + getName() + ": " + member.toString());
            members.put(member.getLocation(), member);
        }

        fireMemberAdded(member);
    }
957676
public void addMemberHeader(ExecutableElement member, Content methodsContentTree) {
        methodsContentTree.addContent(getHead(member));
        methodsContentTree.addContent(getSignature(member));
    }
933765
void onHeartbeat(Member member, long timestamp) {
        if (!heartbeatAwareQuorumFunction) {
            return;
        }
        ((HeartbeatAware) quorumFunction).onHeartbeat(member, timestamp);
    }
688734
private void sync() {
    List<SwimMember> syncMembers = discoveryService.getNodes().stream()
        .map(node -> new SwimMember(MemberId.from(node.id().id()), node.address()))
        .filter(member -> !member.id().equals(localMember.id()))
        .collect(Collectors.toList());
    for (SwimMember member : syncMembers) {
      sync(member.copy());
    }
  }
339463
protected void handleInstallResponse(MemberState member, InstallRequest request, InstallResponse response) {
    if (response.status() == Response.Status.OK) {
      handleInstallResponseOk(member, request, response);
    } else {
      handleInstallResponseError(member, request, response);
    }
  }
718964
private void joinSynchronization()
      throws IOException, TimeoutException, InterruptedException {
    Message sync = MessageBuilder.buildSyncHistory(persistence.getLatestZxid());
    sendMessage(this.electedLeader, sync);
    MessageTuple tuple =
      filter.getExpectedMessage(MessageType.SYNC_HISTORY_REPLY, electedLeader,
                                config.getTimeoutMs());
    Message msg = tuple.getMessage();
    // Updates the sync timeout based on leader's suggestion.
    setSyncTimeoutMs(msg.getSyncHistoryReply().getSyncTimeout());
    // Waits for the first synchronization completes.
    waitForSync(this.electedLeader);

    // Gets the last zxid in disk after first synchronization.
    Zxid lastZxid = persistence.getLatestZxid();
    LOG.debug("After first synchronization, the last zxid is {}", lastZxid);
    // Then issues the JOIN message.
    Message join = MessageBuilder.buildJoin(lastZxid);
    sendMessage(this.electedLeader, join);

    /* -- Synchronizing phase -- */
    changePhase(Phase.SYNCHRONIZING);
    waitForSync(this.electedLeader);
    waitForNewLeaderMessage();
    waitForCommitMessage();
    persistence.setProposedEpoch(persistence.getAckEpoch());
  }
911121
@SuppressWarnings("unused")
  protected void handleInstallResponseOk(RaftMemberContext member, InstallRequest request, InstallResponse response) {
    // Reset the member failure count and update the member's status if necessary.
    succeedAttempt(member);

    // If the install request was completed successfully, set the member's snapshotIndex and reset
    // the next snapshot index/offset.
    if (request.complete()) {
      member.setNextSnapshotIndex(0);
      member.setNextSnapshotOffset(0);
      member.setSnapshotIndex(request.snapshotIndex());
    }
    // If more install requests remain, increment the member's snapshot offset.
    else {
      member.setNextSnapshotOffset(request.chunkOffset() + 1);
    }

    // Recursively append entries to the member.
    appendEntries(member);
  }
579064
public void updateGroupMembers(long logIndex, Collection<Endpoint> members) {
        state.updateGroupMembers(logIndex, members);
        printMemberState();
    }