This is an automated email from the ASF dual-hosted git repository.

zhangzicheng pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/shenyu.git


The following commit(s) were added to refs/heads/master by this push:
     new 5419212464 fix shenyu-plugin-apache-dubbo : set register to false. 
(#5243)
5419212464 is described below

commit 541921246477f967647ef761d4d59b2f80023d93
Author: yudayday <[email protected]>
AuthorDate: Tue Oct 31 01:34:10 2023 +0800

    fix shenyu-plugin-apache-dubbo : set register to false. (#5243)
    
    Co-authored-by: “yutiantian” <[email protected]>
    Co-authored-by: xiaoyu <[email protected]>
    Co-authored-by: moremind <[email protected]>
---
 .../plugin/apache/dubbo/cache/ApacheDubboConfigCache.java    | 12 ++++++++----
 1 file changed, 8 insertions(+), 4 deletions(-)

diff --git 
a/shenyu-plugin/shenyu-plugin-proxy/shenyu-plugin-rpc/shenyu-plugin-dubbo/shenyu-plugin-apache-dubbo/src/main/java/org/apache/shenyu/plugin/apache/dubbo/cache/ApacheDubboConfigCache.java
 
b/shenyu-plugin/shenyu-plugin-proxy/shenyu-plugin-rpc/shenyu-plugin-dubbo/shenyu-plugin-apache-dubbo/src/main/java/org/apache/shenyu/plugin/apache/dubbo/cache/ApacheDubboConfigCache.java
index 0a3114829e..29bb6bb31e 100644
--- 
a/shenyu-plugin/shenyu-plugin-proxy/shenyu-plugin-rpc/shenyu-plugin-dubbo/shenyu-plugin-apache-dubbo/src/main/java/org/apache/shenyu/plugin/apache/dubbo/cache/ApacheDubboConfigCache.java
+++ 
b/shenyu-plugin/shenyu-plugin-proxy/shenyu-plugin-rpc/shenyu-plugin-dubbo/shenyu-plugin-apache-dubbo/src/main/java/org/apache/shenyu/plugin/apache/dubbo/cache/ApacheDubboConfigCache.java
@@ -230,11 +230,15 @@ public final class ApacheDubboConfigCache extends 
DubboConfigCache {
             
Optional.ofNullable(dubboParam.getSent()).ifPresent(reference::setSent);
         }
         if (StringUtils.isNotBlank(namespace)) {
-            if (!registryConfig.getAddress().contains(Constants.NAMESPACE)) {
-                reference.setRegistry(new 
RegistryConfig(registryConfig.getAddress() + "?" + Constants.NAMESPACE + "=" + 
namespace));
+            RegistryConfig registryConfig = new RegistryConfig();
+            registryConfig.setRegister(false);
+            if 
(!this.registryConfig.getAddress().contains(Constants.NAMESPACE)) {
+                registryConfig.setAddress(this.registryConfig.getAddress() + 
"?" + Constants.NAMESPACE + "=" + namespace);
+                reference.setRegistry(registryConfig);
             } else {
-                String newAddress = registryConfig.getAddress().substring(0, 
registryConfig.getAddress().indexOf(Constants.NAMESPACE) + 1) + 
Constants.NAMESPACE + "=" + namespace;
-                reference.setRegistry(new RegistryConfig(newAddress));
+                String newAddress = 
this.registryConfig.getAddress().substring(0, 
this.registryConfig.getAddress().indexOf(Constants.NAMESPACE) + 1) + 
Constants.NAMESPACE + "=" + namespace;
+                registryConfig.setAddress(newAddress);
+                reference.setRegistry(registryConfig);
             }
         } else {
             reference.setRegistry(registryConfig);

Reply via email to