You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@rocketmq.apache.org by GitBox <gi...@apache.org> on 2021/10/25 09:01:13 UTC

[GitHub] [rocketmq] colin-lee opened a new pull request #3427: [ISSUE#3426] reduce unnecessary regex matches when namespace is null

colin-lee opened a new pull request #3427:
URL: https://github.com/apache/rocketmq/pull/3427


   ## reduce unnecessary regex matches when namespace is null
   
   there are too many regex matches, when default namespace is null, which used too much memory.
   
   ## Brief changelog
   
   1. Change ClientConfig, add namespaceInitialized veriable
   
   


-- 
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: dev-unsubscribe@rocketmq.apache.org

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



[GitHub] [rocketmq] yuz10 closed pull request #3427: [ISSUE#3426] reduce unnecessary regex matches when namespace is null

Posted by GitBox <gi...@apache.org>.
yuz10 closed pull request #3427:
URL: https://github.com/apache/rocketmq/pull/3427


   


-- 
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: dev-unsubscribe@rocketmq.apache.org

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



[GitHub] [rocketmq] yuz10 closed pull request #3427: [ISSUE#3426] reduce unnecessary regex matches when namespace is null

Posted by GitBox <gi...@apache.org>.
yuz10 closed pull request #3427:
URL: https://github.com/apache/rocketmq/pull/3427


   


-- 
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: dev-unsubscribe@rocketmq.apache.org

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



[GitHub] [rocketmq] Jason918 commented on a change in pull request #3427: [ISSUE#3426] reduce unnecessary regex matches when namespace is null

Posted by GitBox <gi...@apache.org>.
Jason918 commented on a change in pull request #3427:
URL: https://github.com/apache/rocketmq/pull/3427#discussion_r736084914



##########
File path: client/src/main/java/org/apache/rocketmq/client/ClientConfig.java
##########
@@ -274,20 +275,28 @@ public void setLanguage(LanguageCode language) {
     }
 
     public String getNamespace() {
+        if (namespaceInitialized) {
+            return namespace;
+        }
+
         if (StringUtils.isNotEmpty(namespace)) {
             return namespace;
         }
 
         if (StringUtils.isNotEmpty(this.namesrvAddr)) {
             if (NameServerAddressUtils.validateInstanceEndpoint(namesrvAddr)) {
-                return NameServerAddressUtils.parseInstanceIdFromEndpoint(namesrvAddr);
+                namespace = NameServerAddressUtils.parseInstanceIdFromEndpoint(namesrvAddr);

Review comment:
       The `namesrvAddr` is not final and can be updated after creation.
   This will break the compatibility.
   It's better that we can update namespace in `setNamesrvAddr`.




-- 
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: dev-unsubscribe@rocketmq.apache.org

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



[GitHub] [rocketmq] colin-lee commented on a change in pull request #3427: [ISSUE#3426] reduce unnecessary regex matches when namespace is null

Posted by GitBox <gi...@apache.org>.
colin-lee commented on a change in pull request #3427:
URL: https://github.com/apache/rocketmq/pull/3427#discussion_r736146388



##########
File path: client/src/main/java/org/apache/rocketmq/client/ClientConfig.java
##########
@@ -274,20 +275,28 @@ public void setLanguage(LanguageCode language) {
     }
 
     public String getNamespace() {
+        if (namespaceInitialized) {
+            return namespace;
+        }
+
         if (StringUtils.isNotEmpty(namespace)) {
             return namespace;
         }
 
         if (StringUtils.isNotEmpty(this.namesrvAddr)) {
             if (NameServerAddressUtils.validateInstanceEndpoint(namesrvAddr)) {
-                return NameServerAddressUtils.parseInstanceIdFromEndpoint(namesrvAddr);
+                namespace = NameServerAddressUtils.parseInstanceIdFromEndpoint(namesrvAddr);

Review comment:
       please fixup it.




-- 
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: dev-unsubscribe@rocketmq.apache.org

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