YoWuwuuuw commented on code in PR #9131: URL: https://github.com/apache/rocketmq/pull/9131#discussion_r1981021126
########## broker/src/main/java/org/apache/rocketmq/broker/processor/PopRebalanceCacheManager.java: ########## @@ -0,0 +1,79 @@ +package org.apache.rocketmq.broker.processor; + +import org.apache.rocketmq.common.constant.LoggerName; +import org.apache.rocketmq.common.message.MessageQueue; +import org.apache.rocketmq.logging.org.slf4j.Logger; +import org.apache.rocketmq.logging.org.slf4j.LoggerFactory; +import java.util.List; +import java.util.Set; +import java.util.concurrent.ConcurrentHashMap; +import java.util.concurrent.ConcurrentMap; +import java.util.concurrent.TimeUnit; +import java.util.concurrent.locks.Lock; +import java.util.concurrent.locks.ReentrantLock; + +public class PopRebalanceCacheManager { + + private static final long LOCK_TIMEOUT_MILLIS = 3000L; + + private static final Logger log = LoggerFactory.getLogger(LoggerName.BROKER_LOGGER_NAME); + + // Cache with pop mode rebalancing under the condition that consumer groups and queues remain unchanged + private final ConcurrentMap<String, ConcurrentHashMap<String, Set<MessageQueue>>> loadBalanceDateTable = new ConcurrentHashMap<>(); Review Comment: Ok, I've added a cleanup thread for PopCacheManager and tested it to completely clear the cache every 24 hours (the cache expiration only happens when the topic goes offline, and I'll modify "Brief Description" to simply explain the cache logic). This cleanup interval can be added to the configuration if needed later -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: commits-unsubscr...@rocketmq.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org