QiuMM edited a comment on issue #6263: Add ability to specify list of task ports
URL: https://github.com/apache/incubator-druid/pull/6263#issuecomment-418809754
 
 
   @himanshug I think we can modify current code:
   ```java
   private int chooseNext(int start)
     {
       // up to unsigned short max (65535)
       for (int i = start; i <= 0xFFFF; i++) {
         if (!usedPorts.contains(i)) {
           return i;
         }
       }
       throw new ISE("All ports are Used..");
     }
   ```
   to like this:
   ```java 
   private int chooseNext(int start)
     {
       // up to endPort (which default value is 65535)
       for (int i = start; i <= endPort; i++) {
         if (!usedPorts.contains(i)) {
           return i;
         }
       }
       throw new ISE("All ports are Used..");
     }
   ```
   And `endPort` can be defined like this:
   ```java
     @JsonProperty
     @Min(1024)
     @Max(65535)
     private int endPort = 65535;
   ```
   which is similar to current `startPort` definition:
   ```java
     @JsonProperty
     @Min(1024)
     @Max(65535)
     private int startPort = 8100;
   ```
   And the `endPort` value restrictions should be descripted in documentation  
to let users know. In this way, I think users don't have to think about 
technicality of possible port numbers.

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on 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


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscr...@druid.apache.org
For additional commands, e-mail: commits-h...@druid.apache.org

Reply via email to