[ 
https://issues.apache.org/jira/browse/HDFS-16481?focusedWorklogId=735783&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-735783
 ]

ASF GitHub Bot logged work on HDFS-16481:
-----------------------------------------

                Author: ASF GitHub Bot
            Created on: 03/Mar/22 05:58
            Start Date: 03/Mar/22 05:58
    Worklog Time Spent: 10m 
      Work Description: virajjasani commented on a change in pull request #4028:
URL: https://github.com/apache/hadoop/pull/4028#discussion_r818338290



##########
File path: 
hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/net/NetUtils.java
##########
@@ -1053,6 +1053,25 @@ public static int getFreeSocketPort() {
     return port;
   }
 
+  /**
+   * Return free ports. There is no guarantee they will remain free, so
+   * ports should be used immediately. The number of free ports returned by
+   * this method should match argument {@code numOfPorts}.
+   *
+   * @param numOfPorts Number of free ports to acquire.
+   * @return Free ports for binding a local socket.
+   */
+  public static Set<Integer> getFreeSocketPorts(int numOfPorts) {
+    final Set<Integer> freePorts = new HashSet<>(numOfPorts);
+    for (int i = 0; i < numOfPorts * 5; i++) {
+      freePorts.add(getFreeSocketPort());

Review comment:
       Yes, let me take care of this.




-- 
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: common-issues-unsubscr...@hadoop.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


Issue Time Tracking
-------------------

    Worklog Id:     (was: 735783)
    Time Spent: 5h  (was: 4h 50m)

> Provide support to set Http and Rpc ports in MiniJournalCluster
> ---------------------------------------------------------------
>
>                 Key: HDFS-16481
>                 URL: https://issues.apache.org/jira/browse/HDFS-16481
>             Project: Hadoop HDFS
>          Issue Type: Task
>            Reporter: Viraj Jasani
>            Assignee: Viraj Jasani
>            Priority: Major
>              Labels: pull-request-available
>          Time Spent: 5h
>  Remaining Estimate: 0h
>
> We should provide support for clients to set Http and Rpc ports of 
> JournalNodes in MiniJournalCluster.



--
This message was sent by Atlassian Jira
(v8.20.1#820001)

---------------------------------------------------------------------
To unsubscribe, e-mail: hdfs-issues-unsubscr...@hadoop.apache.org
For additional commands, e-mail: hdfs-issues-h...@hadoop.apache.org

Reply via email to