public void unregisterChannel(final ClientChannelInfo clientChannelInfo) {
   ClientChannelInfo old = this.channelInfoTable.remove(clientChannelInfo.getChannel().hashCode());
   if (old != null) {
     log.info(
         "unregister a consumer[{}] from consumerGroupInfo {}", this.groupName, old.toString());
   }
 }
  /** 返回值表示是否发生变更 */
  public boolean updateChannel(
      final ClientChannelInfo clientChannelInfo,
      ConsumeType consumeType,
      MessageModel messageModel,
      ConsumeFromWhere consumeFromWhere) {
    boolean updated = false;
    this.consumeType = consumeType;
    this.messageModel = messageModel;
    this.consumeFromWhere = consumeFromWhere;

    ClientChannelInfo info = this.channelInfoTable.get(clientChannelInfo.getChannel());
    if (null == info) {
      ClientChannelInfo prev =
          this.channelInfoTable.put(clientChannelInfo.getChannel(), clientChannelInfo);
      if (null == prev) {
        log.info(
            "new consumer connected, group: {} {} {} channel: {}",
            this.groupName,
            consumeType,
            messageModel,
            clientChannelInfo.toString());
        updated = true;
      }

      info = clientChannelInfo;
    }

    this.lastUpdateTimestamp = System.currentTimeMillis();
    info.setLastUpdateTimestamp(this.lastUpdateTimestamp);

    return updated;
  }
 public void doChannelCloseEvent(final String remoteAddr, final Channel channel) {
   final ClientChannelInfo info = this.channelInfoTable.remove(channel);
   if (info != null) {
     log.warn(
         "NETTY EVENT: remove not active channel[{}] from ConsumerGroupInfo groupChannelTable, consumer group: {}",
         info.toString(),
         groupName);
   }
 }
  public List<String> getAllClientId() {
    List<String> result = new ArrayList<String>();

    Iterator<Entry<Channel, ClientChannelInfo>> it = this.channelInfoTable.entrySet().iterator();

    while (it.hasNext()) {
      Entry<Channel, ClientChannelInfo> entry = it.next();
      ClientChannelInfo clientChannelInfo = entry.getValue();
      result.add(clientChannelInfo.getClientId());
    }

    return result;
  }