Oliverwqcwrw commented on code in PR #5014:
URL: https://github.com/apache/rocketmq/pull/5014#discussion_r965415529
##########
remoting/src/main/java/org/apache/rocketmq/remoting/netty/NettyRemotingServer.java:
##########
@@ -240,15 +239,18 @@ public void initChannel(SocketChannel ch) {
addCustomConfig(serverBootstrap);
try {
- ChannelFuture sync =
serverBootstrap.bind(nettyServerConfig.getListenPort()).sync();
+ ChannelFuture sync = serverBootstrap.bind().sync();
InetSocketAddress addr = (InetSocketAddress)
sync.channel().localAddress();
if (0 == nettyServerConfig.getListenPort()) {
this.nettyServerConfig.setListenPort(addr.getPort());
- log.debug("Server is listening {}",
this.nettyServerConfig.getListenPort());
+ log.info("Server is listening {}:{}",
this.nettyServerConfig.getBindIP(), this.nettyServerConfig.getListenPort());
}
this.remotingServerTable.put(this.nettyServerConfig.getListenPort(), this);
- } catch (InterruptedException e1) {
- throw new RuntimeException("this.serverBootstrap.bind().sync()
InterruptedException", e1);
+ } catch (Exception e) {
+ if (e instanceof BindException) {
+ throw new RuntimeException("bind to " +
this.nettyServerConfig.getBindIP() + ":" +
this.nettyServerConfig.getListenPort() + " failed", e);
+ }
+ throw new RuntimeException("this.serverBootstrap.bind().sync()
InterruptedException", e);
Review Comment:
```suggestion
throw new RuntimeException("this.serverBootstrap.bind().sync()
failed", e);
```
IMO, If the exception is not BindException, it is not necessarily
InterruptedException
--
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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]