lw309637554 commented on a change in pull request #2142: URL: https://github.com/apache/hudi/pull/2142#discussion_r499549836
########## File path: hudi-timeline-service/src/main/java/org/apache/hudi/timeline/service/TimelineService.java ########## @@ -98,16 +98,42 @@ public TimelineService(Config config) throws IOException { public Boolean help = false; } + private int startServiceOnPort(int port) throws IOException { + if (!(port == 0 || (1024 <= port && port < 65536))) { + throw new IllegalArgumentException(String.format("startPort should be between 1024 and 65535 (inclusive), " + + "or 0 for a random free port. but now is %s.", port)); + } + int maxRetries = 16; Review comment: > you also probably want to add a small wait between attempts? i think not need to add a small wait between attempts. because in most cases will retry when port is already in use, a attempt will change to new port . ########## File path: hudi-timeline-service/src/main/java/org/apache/hudi/timeline/service/TimelineService.java ########## @@ -98,16 +98,42 @@ public TimelineService(Config config) throws IOException { public Boolean help = false; } + private int startServiceOnPort(int port) throws IOException { + if (!(port == 0 || (1024 <= port && port < 65536))) { + throw new IllegalArgumentException(String.format("startPort should be between 1024 and 65535 (inclusive), " + + "or 0 for a random free port. but now is %s.", port)); + } + int maxRetries = 16; + for (int offset = 0; offset < maxRetries; offset++) { Review comment: done ---------------------------------------------------------------- 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: us...@infra.apache.org