BurningCN commented on code in PR #10342:
URL: https://github.com/apache/dubbo/pull/10342#discussion_r926856873


##########
dubbo-common/src/main/java/org/apache/dubbo/common/threadpool/manager/DefaultExecutorRepository.java:
##########
@@ -83,8 +84,14 @@ public synchronized ExecutorService 
createExecutorIfAbsent(URL url) {
         Map<Integer, ExecutorService> executors = 
data.computeIfAbsent(getExecutorKey(url), k -> new ConcurrentHashMap<>());
         // Consumer's executor is sharing globally, key=Integer.MAX_VALUE. 
Provider's executor is sharing by protocol.
         Integer portKey = 
CONSUMER_SIDE.equalsIgnoreCase(url.getParameter(SIDE_KEY)) ? Integer.MAX_VALUE 
: url.getPort();
+
+        String protocol = url.getProtocol();
+        if (StringUtils.isEmpty(protocol)) {
+            protocol = DEFAULT_PROTOCOL;
+        }
+
         if (url.getParameter(THREAD_NAME_KEY) == null) {
-            url = url.putAttribute(THREAD_NAME_KEY, "Dubbo-protocol-" + 
portKey);
+            url = url.putAttribute(THREAD_NAME_KEY, protocol + "-protocol-" + 
portKey);

Review Comment:
   
大佬好,不知道我有没有表达清楚。我看到88~91行这段获取的protocol变量只有在threadNameKey为空的时候才使用到,如果93行条件不满足,即url已经有threadNameKey了,那么88~91行获取protocol的操作是不是就没有意义了。



##########
dubbo-common/src/main/java/org/apache/dubbo/common/threadpool/manager/DefaultExecutorRepository.java:
##########
@@ -83,8 +84,14 @@ public synchronized ExecutorService 
createExecutorIfAbsent(URL url) {
         Map<Integer, ExecutorService> executors = 
data.computeIfAbsent(getExecutorKey(url), k -> new ConcurrentHashMap<>());
         // Consumer's executor is sharing globally, key=Integer.MAX_VALUE. 
Provider's executor is sharing by protocol.
         Integer portKey = 
CONSUMER_SIDE.equalsIgnoreCase(url.getParameter(SIDE_KEY)) ? Integer.MAX_VALUE 
: url.getPort();
+
+        String protocol = url.getProtocol();
+        if (StringUtils.isEmpty(protocol)) {
+            protocol = DEFAULT_PROTOCOL;
+        }
+
         if (url.getParameter(THREAD_NAME_KEY) == null) {
-            url = url.putAttribute(THREAD_NAME_KEY, "Dubbo-protocol-" + 
portKey);
+            url = url.putAttribute(THREAD_NAME_KEY, protocol + "-protocol-" + 
portKey);

Review Comment:
   
大佬好,不知道我有没有表达清楚。我看到88-91行这段获取的protocol变量只有在threadNameKey为空的时候才使用到,如果93行条件不满足,即url已经有threadNameKey了,那么88~91行获取protocol的操作是不是就没有意义了。



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


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to