Github user sohami commented on a diff in the pull request:

    https://github.com/apache/drill/pull/1203#discussion_r181179746
  
    --- Diff: 
exec/java-exec/src/main/java/org/apache/drill/exec/server/Drillbit.java ---
    @@ -189,11 +189,16 @@ public void run() throws Exception {
         drillbitContext.getOptionManager().init();
         javaPropertiesToSystemOptions();
         
manager.getContext().getRemoteFunctionRegistry().init(context.getConfig(), 
storeProvider, coord);
    -    registrationHandle = coord.register(md);
         webServer.start();
    -
    +    //Discovering HTTP port (in case of port hunting)
    +    if (webServer.isRunning()) {
    +      int httpPort = getWebServerPort();
    +      registrationHandle = 
coord.register(md.toBuilder().setHttpPort(httpPort).build());
    +    } else {
    +      //WebServer is not running
    +      registrationHandle = coord.register(md);
    +    }
    --- End diff --
    
    how about changing with below:
    ```
    
    if (webServer.isRunning()) {
        final int httpPort = getWebServerPort();
        md = md.toBuilder().setHttpPort(httpPort).build();
    }
    registrationHandle = coord.register(md);
    ```


---

Reply via email to