void openListeners() throws Exception {
    for (ListenerInfo li : listeners) {
      ServerConnector listener = li.listener;
      if (!li.isManaged || (li.listener.getLocalPort() != -1 && li.listener.getLocalPort() != -2)) {
        // This listener is either started externally, or has not been opened, or has been closed
        continue;
      }
      int port = listener.getPort();
      while (true) {
        // jetty has a bug where you can't reopen a listener that previously
        // failed to open w/o issuing a close first, even if the port is changed
        try {
          listener.close();
          listener.open();
          LOG.info("Jetty bound to port " + listener.getLocalPort());
          break;
        } catch (IOException ex) {
          if (!(ex instanceof BindException) && !(ex.getCause() instanceof BindException)) {
            throw ex;
          }
          if (port == 0 || !findPort) {
            BindException be =
              new BindException("Port in use: " + listener.getHost() + ":" + listener.getPort());
            be.initCause(ex);
            throw be;
          }
        }
        // try the next port number
        listener.setPort(++port);
        Thread.sleep(100);
      }
    }
  }
Open the main listener for the server
@throws Exception if the listener cannot be opened or the appropriate port is already in use
hbase-http/src/main/java/org/apache/hadoop/hbase/http/HttpServer.java