private boolean switchStatsSets() {
        long curSwitchTime = lstSnapshotTime.get();
        // Avoid frequent snapshots
        if ((System.currentTimeMillis() - curSwitchTime) >= TBaseConstants.CFG_STATS_MIN_SNAPSHOT_PERIOD_MS) {
            if (lstSnapshotTime.compareAndSet(curSwitchTime, System.currentTimeMillis())) {
                msgStoreStatsSets[getIndex(writableIndex.get() - 1)].clear();
                msgStoreStatsSets[getIndex(writableIndex.getAndIncrement())]
                        .setSnapshotTime(lstSnapshotTime.get());
                return true;
            }
        }
        return false;
    }
Check and switch statistic sets

@return  whether the statistic sets has been switched
inlong-tubemq/tubemq-server/src/main/java/org/apache/inlong/tubemq/server/broker/stats/MsgStoreStatsHolder.java