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

crazyhzm pushed a commit to branch 3.2
in repository https://gitbox.apache.org/repos/asf/dubbo.git


The following commit(s) were added to refs/heads/3.2 by this push:
     new dce7b87632 Read heartbeat from util when recreate url in 
ExchangeClient (#12605)
dce7b87632 is described below

commit dce7b87632acabdcb1c0e1f6527eb3095e0c5992
Author: Albumen Kevin <[email protected]>
AuthorDate: Tue Jun 27 18:00:51 2023 +0800

    Read heartbeat from util when recreate url in ExchangeClient (#12605)
---
 .../main/java/org/apache/dubbo/rpc/protocol/dubbo/DubboProtocol.java  | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git 
a/dubbo-rpc/dubbo-rpc-dubbo/src/main/java/org/apache/dubbo/rpc/protocol/dubbo/DubboProtocol.java
 
b/dubbo-rpc/dubbo-rpc-dubbo/src/main/java/org/apache/dubbo/rpc/protocol/dubbo/DubboProtocol.java
index 3c0138e0d6..2483f78d00 100644
--- 
a/dubbo-rpc/dubbo-rpc-dubbo/src/main/java/org/apache/dubbo/rpc/protocol/dubbo/DubboProtocol.java
+++ 
b/dubbo-rpc/dubbo-rpc-dubbo/src/main/java/org/apache/dubbo/rpc/protocol/dubbo/DubboProtocol.java
@@ -34,6 +34,7 @@ import org.apache.dubbo.remoting.exchange.ExchangeServer;
 import org.apache.dubbo.remoting.exchange.Exchangers;
 import org.apache.dubbo.remoting.exchange.PortUnificationExchanger;
 import org.apache.dubbo.remoting.exchange.support.ExchangeHandlerAdapter;
+import org.apache.dubbo.remoting.utils.UrlUtils;
 import org.apache.dubbo.rpc.Exporter;
 import org.apache.dubbo.rpc.Invocation;
 import org.apache.dubbo.rpc.Invoker;
@@ -514,11 +515,12 @@ public class DubboProtocol extends AbstractProtocol {
         }
 
         try {
+            int heartbeat = UrlUtils.getHeartbeat(url);
             // Replace InstanceAddressURL with ServiceConfigURL.
             url = new ServiceConfigURL(DubboCodec.NAME, url.getUsername(), 
url.getPassword(), url.getHost(), url.getPort(), url.getPath(), 
url.getAllParameters());
             url = url.addParameter(CODEC_KEY, DubboCodec.NAME);
             // enable heartbeat by default
-            url = url.addParameterIfAbsent(HEARTBEAT_KEY, 
String.valueOf(DEFAULT_HEARTBEAT));
+            url = url.addParameterIfAbsent(HEARTBEAT_KEY, 
Integer.toString(heartbeat));
 
             // connection should be lazy
             return url.getParameter(LAZY_CONNECT_KEY, false)

Reply via email to