private void registerSwitch()

in grpc-gcp/src/main/java/com/google/cloud/grpc/multiendpoint/MultiEndpoint.java [270:292]


  private void registerSwitch(String fromId, String toId) {
    if (toId.equals(fromId) || fromId == null) {
      return;
    }

    int fromIdx = -1;
    int toIdx = -1;
    for (Endpoint e : endpointsMap.values()) {
      if (e.getId().equals(fromId)) {
        fromIdx = e.getPriority();
      } else if (e.getId().equals(toId)) {
        toIdx = e.getPriority();
      }
    }

    if (fromIdx == -1) {
      replaceCnt++;
    } else if (fromIdx < toIdx) {
      fallbackCnt++;
    } else {
      recoverCnt++;
    }
  }