public boolean addConsumer(ConsumerInfo consumer, boolean isNotAllocated,
            StringBuilder strBuff, ProcessResult result) {
        ConsumeGroupInfo consumeGroupInfo;
        String group = consumer.getGroupName();
        Integer lid = null;
        try {
            lid = groupRowLock.getLock(null,
                    StringUtils.getBytesUtf8(group), true);
            consumeGroupInfo = groupInfoMap.get(group);
            if (consumeGroupInfo == null) {
                ConsumeGroupInfo tmpGroupInfo = new ConsumeGroupInfo(consumer);
                consumeGroupInfo = groupInfoMap.putIfAbsent(group, tmpGroupInfo);
                if (consumeGroupInfo == null) {
                    consumeGroupInfo = tmpGroupInfo;
                    if (tmpGroupInfo.isClientBalance()) {
                        clientBalanceGroupSet.add(group);
                    } else {
                        serverBalanceGroupSet.add(group);
                    }
                    // add topic-group map information
                    ConcurrentHashSet<String> groupSet;
                    for (String topicName : consumeGroupInfo.getTopicSet()) {
                        groupSet = topicGroupMap.get(topicName);
                        if (groupSet == null) {
                            ConcurrentHashSet<String> tmpGroupSet = new ConcurrentHashSet<>();
                            groupSet = topicGroupMap.putIfAbsent(topicName, tmpGroupSet);
                            if (groupSet == null) {
                                groupSet = tmpGroupSet;
                            }
                        }
                        groupSet.add(group);
                    }
                    // statistic data
                    MasterSrvStatsHolder.incConsumerCnt(true,
                            consumeGroupInfo.isClientBalance());
                }
            }
            if (consumeGroupInfo.addConsumer(consumer, strBuff, result)) {
                if ((Boolean) result.getRetData()) {
                    MasterSrvStatsHolder.incConsumerCnt(false,
                            consumeGroupInfo.isClientBalance());
                }
                if (!isNotAllocated) {
                    consumeGroupInfo.settAllocated();
                }
                consumerIndexMap.put(consumer.getConsumerId(), group);
                result.setSuccResult(consumeGroupInfo);
            }
        } catch (IOException e) {
            logger.warn("Failed to lock.", e);
        } finally {
            if (lid != null) {
                groupRowLock.releaseRowLock(lid);
            }
        }
        return result.isSuccess();
    }
Add consumer and return group object,
if the consumer is the first one, then create the group object

@param consumer consumer info
@param isNotAllocated whether balanced
@param strBuff  string buffer
@param result   check result
@return process result
inlong-tubemq/tubemq-server/src/main/java/org/apache/inlong/tubemq/server/master/nodemanage/nodeconsumer/ConsumerInfoHolder.java