You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@dubbo.apache.org by "chickenlj (via GitHub)" <gi...@apache.org> on 2023/08/31 14:44:51 UTC

[GitHub] [dubbo] chickenlj commented on a diff in pull request #12987: Retry bind if bind failed

chickenlj commented on code in PR #12987:
URL: https://github.com/apache/dubbo/pull/12987#discussion_r1311745808


##########
dubbo-remoting/dubbo-remoting-netty4/src/main/java/org/apache/dubbo/remoting/transport/netty4/NettyPortUnificationServer.java:
##########
@@ -138,9 +139,31 @@ protected void initChannel(SocketChannel ch) throws Exception {
             bindIp = ANYHOST_VALUE;
         }
         InetSocketAddress bindAddress = new InetSocketAddress(bindIp, bindPort);
-        ChannelFuture channelFuture = bootstrap.bind(bindAddress);
-        channelFuture.syncUninterruptibly();
-        channel = channelFuture.channel();
+        Throwable lastError = null;
+        int retryTimes = getUrl().getParameter(Constants.BIND_RETRY_TIMES, 10);
+        int retryInterval = getUrl().getParameter(Constants.BIND_RETRY_INTERVAL, 3000);
+        for (int i = 0; i < retryTimes; i++) {

Review Comment:
   Why would we need binding retry, what's the problem with throwing exception directly on binding failure.



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