merlimat commented on a change in pull request #5024: Improve Port Manager
URL: https://github.com/apache/pulsar/pull/5024#discussion_r317795901
 
 

 ##########
 File path: 
managed-ledger/src/test/java/org/apache/bookkeeper/test/PortManager.java
 ##########
 @@ -95,7 +97,9 @@ private synchronized static int probeFreePort(int port) {
                 port = basePort;
             }
 
-            try (ServerSocket ss = new ServerSocket(port)) {
+            try (ServerSocket ss = new ServerSocket()) {
+                ss.setReuseAddress(false);
+                ss.bind(new 
InetSocketAddress(InetAddress.getByName("localhost"), port), 1);
 
 Review comment:
   What's the difference between doing the bind and passing the port in the 
`ServerSocket` constructor? Also, "reuse address" should already be false by 
default.

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

Reply via email to