class PickFirstLoadBalancer extends LoadBalancer {

  @Override
  public void handleResolvedAddressGroups(
      List<EquivalentAddressGroup> servers, Attributes attributes) {
    if (servers == null || servers.isEmpty()) {
      String errorMsg = "传入的servers参数不能为空";
      logger.error(errorMsg);
      throw new RuntimeException(errorMsg);
    }

    EquivalentAddressGroup currentAddressGroup = servers.get(0);
    Subchannel subchannel = subchannels.get(currentAddressGroup);

    // 如果含有多个服务端地址，只考虑第一个
    if (servers.size() > 1) {
      servers = servers.subList(0, 1);
    }

    if (subchannel == null) {
      subchannel = helper.createSubchannel(servers, Attributes.EMPTY);
      Subchannel oldValue = subchannels.putIfAbsent(currentAddressGroup, subchannel);
      if (oldValue == null) {
        // The channel state does not get updated when doing name resolving today, so for the moment
        // let LB report CONNECTION and call subchannel.requestConnection() immediately.
        helper.updateBalancingState(CONNECTING, new Picker(PickResult.withSubchannel(subchannel)));
        subchannel.requestConnection();
      } else {
        subchannel = oldValue;
        helper.updateBalancingState(READY, new Picker(PickResult.withSubchannel(subchannel)));
      }
    } else {
      // helper.updateSubchannelAddresses(subchannel, servers);
      helper.updateBalancingState(READY, new Picker(PickResult.withSubchannel(subchannel)));
    }

    currentSubchannel = subchannel;
  }

    PickFirstLoadBalancer(Helper helper);

}