You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@dubbo.apache.org by GitBox <gi...@apache.org> on 2022/08/13 16:52:37 UTC

[GitHub] [dubbo] liufeiyu1002 commented on a diff in pull request #10234: #10227 优化subscribe时初始化性能,经过优化后,该场景在开发环境下从5~20秒性能提升至300~1000ms,提升5~20倍,基本上在30…

liufeiyu1002 commented on code in PR #10234:
URL: https://github.com/apache/dubbo/pull/10234#discussion_r945168299


##########
dubbo-remoting/dubbo-remoting-redis/src/main/java/org/apache/dubbo/remoting/redis/jedis/SentinelRedisClient.java:
##########
@@ -49,6 +49,14 @@ public SentinelRedisClient(URL url) {
         sentinelPool = new JedisSentinelPool(masterName, sentinels, getConfig(), url.getPassword());
     }
 
+    @Override
+    public boolean exists(String key) {
+        Jedis jedis = sentinelPool.getResource();
+        boolean result = jedis.exists(key);
+        jedis.close();

Review Comment:
   这些不使用 try finally 包起来么?  在 finally 里关闭(归还) jedis 么
   ```
   try(Jedis jedis = sentinelPool.getResource()){
    boolean result = jedis.exists(key);
   return result;
   }catch (Exception e){
   throw e;
   }
   ```



-- 
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: notifications-unsubscribe@dubbo.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For additional commands, e-mail: notifications-help@dubbo.apache.org