fuyou001 commented on code in PR #4669:
URL: https://github.com/apache/rocketmq/pull/4669#discussion_r937308817


##########
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:
   1. fix
   2. if occur exceptions then return old value,see   
https://github.com/ben-manes/caffeine/wiki/Refresh
   



-- 
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]

Reply via email to