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/26 01:59:37 UTC

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

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