private int releaseAllGroupIdSenders(Map<String, BaseSender> senderMap) {
        int totalSenderCnt = 0;
        for (Map.Entry<String, BaseSender> entry : senderMap.entrySet()) {
            if (entry == null || entry.getKey() == null || entry.getValue() == null) {
                continue;
            }
            try {
                entry.getValue().close();
            } catch (Throwable ex) {
                if (exptCounter.shouldPrint()) {
                    logger.warn("MsgSenderFactory({}) close groupId({})'s sender failure",
                            this.factoryNo, entry.getKey(), ex);
                }
            }
            totalSenderCnt++;
        }
        senderMap.clear();
        return totalSenderCnt;
    }
Base Message Sender Factory

Used to manage the instance relationship of the sender factory.
Since both singleton and multiple instances involve the same relationship,
they are abstracted and maintained separately here.
inlong-sdk/dataproxy-sdk/src/main/java/org/apache/inlong/sdk/dataproxy/BaseMsgSenderFactory.java