code: private int getDatanodeHttpPort(Configuration conf) {
      String address = conf.get("dfs.datanode.http.address", "");
      if (address.equals("")) {
        return -1;
      }
      return Integer.parseInt(address.split(":")[1]);
    }
docs: Get datanode http port from configration