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/07/21 03:06:16 UTC
[GitHub] [dubbo] BurningCN commented on a diff in pull request #10342: Fix triple protocol thread name
BurningCN commented on code in PR #10342:
URL: https://github.com/apache/dubbo/pull/10342#discussion_r926211636
##########
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:
Can this logic be put in this? The protocol key is obtained only when the thread name key is not set
(这段逻辑是否可以放到这个里面,只在没有设置线程名称key的时候,才会去获取protocol key)

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