zhouxinyu commented on code in PR #4669:
URL: https://github.com/apache/rocketmq/pull/4669#discussion_r932191535
##########
proxy/src/main/java/org/apache/rocketmq/proxy/service/route/TopicRouteService.java:
##########
@@ -64,10 +68,14 @@ public TopicRouteService(MQClientAPIFactory
mqClientAPIFactory) {
config.getTopicRouteServiceThreadPoolQueueCapacity()
);
this.mqClientAPIFactory = mqClientAPIFactory;
- this.topicCache = CacheBuilder.newBuilder()
- .maximumSize(config.getTopicRouteServiceCacheMaxNum())
-
.refreshAfterWrite(config.getTopicRouteServiceCacheExpiredInSeconds(),
TimeUnit.SECONDS)
- .build(new TopicRouteCacheLoader());
+
+ this.topicCache =
Caffeine.newBuilder().maximumSize(config.getTopicRouteServiceCacheMaxNum()).
+
refreshAfterWrite(config.getTopicRouteServiceCacheExpiredInSeconds(),
TimeUnit.SECONDS).
+ executor(cacheRefreshExecutor).build(new CacheLoader<String,
MessageQueueView>() {
+ @Override public @Nullable MessageQueueView load(String topic)
throws Exception {
+ return topicRouteCacheLoader.load(topic);
Review Comment:
Does caffeine have the same error handling process as guava cache?
We must ensure that:
1. TopicRoute info should be discarded if TOPIC_NOT_EXIST occurs.
2. TopicRoute info should be kept if unexpected exceptions occur to tolerate
namesrv failure.
--
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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]