You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pulsar.apache.org by GitBox <gi...@apache.org> on 2019/08/26 20:58:35 UTC

[GitHub] [pulsar] merlimat commented on a change in pull request #5024: Improve Port Manager

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:
users@infra.apache.org


With regards,
Apache Git Services