Source:
<code>@Override public void start(GridRestProtocolHandler hnd) throws IgniteCheckedException { assert ctx.config().getConnectorConfiguration() != null; InetAddress locHost; try { locHost = U.resolveLocalHost(ctx.config().getLocalHost()); } catch (IOException e) { throw new IgniteCheckedException("Failed to resolve local host to bind address: " + ctx.config().getLocalHost(), e); } <START> if (System.getProperty(IGNITE_JETTY_HOST) == null) <END> System.setProperty(IGNITE_JETTY_HOST, locHost.getHostAddress()); jettyHnd = new GridJettyRestHandler(hnd, new C1<String, Boolean>() { @Override public Boolean apply(String tok) { return F.isEmpty(secretKey) || authenticate(tok); } }, log); String jettyPath = config().getJettyPath(); final URL cfgUrl; if (jettyPath == null) { cfgUrl = null; if (log.isDebugEnabled()) log.debug("Jetty configuration file is not provided, using defaults."); } else { cfgUrl = U.resolveIgniteUrl(jettyPath); if (cfgUrl == null) throw new IgniteSpiException("Invalid Jetty configuration file: " + jettyPath); else if (log.isDebugEnabled()) log.debug("Jetty configuration file: " + cfgUrl); } loadJettyConfiguration(cfgUrl); AbstractNetworkConnector connector = getJettyConnector(); try { host = InetAddress.getByName(connector.getHost()); } catch (UnknownHostException e) { throw new IgniteCheckedException("Failed to resolve Jetty host address: " + connector.getHost(), e); } int initPort = connector.getPort(); int portRange = config().getPortRange(); int lastPort = portRange == 0 ? initPort : initPort + portRange - 1; for (port = initPort; port <= lastPort; port++) { connector.setPort(port); if (startJetty()) { if (log.isInfoEnabled()) log.info(startInfo()); return; } } U.warn(log, "Failed to start Jetty REST server (possibly all ports in range are in use) " + "[firstPort=" + initPort + ", lastPort=" + lastPort + ']'); }</code><technical_language>move this "if" locHost check? In case IGNITE_JETTY_HOST try resolve instead of ctx.config().getLocalHost()</technical_language>

Target:
@Override public void start(GridRestProtocolHandler hnd) throws IgniteCheckedException { assert ctx.config().getConnectorConfiguration() != null; String jettyHost = System.getProperty(IGNITE_JETTY_HOST, ctx.config().getLocalHost()); try { System.setProperty(IGNITE_JETTY_HOST, U.resolveLocalHost(jettyHost).getHostAddress()); } catch (IOException e) { throw new IgniteCheckedException("Failed to resolve host to bind address: " + jettyHost, e); } jettyHnd = new GridJettyRestHandler(hnd, new C1<String, Boolean>() { @Override public Boolean apply(String tok) { return F.isEmpty(secretKey) || authenticate(tok); } }, log); String jettyPath = config().getJettyPath(); final URL cfgUrl; if (jettyPath == null) { cfgUrl = null; if (log.isDebugEnabled()) log.debug("Jetty configuration file is not provided, using defaults."); } else { cfgUrl = U.resolveIgniteUrl(jettyPath); if (cfgUrl == null) throw new IgniteSpiException("Invalid Jetty configuration file: " + jettyPath); else if (log.isDebugEnabled()) log.debug("Jetty configuration file: " + cfgUrl); } loadJettyConfiguration(cfgUrl); AbstractNetworkConnector connector = getJettyConnector(); try { host = InetAddress.getByName(connector.getHost()); } catch (UnknownHostException e) { throw new IgniteCheckedException("Failed to resolve Jetty host address: " + connector.getHost(), e); } int initPort = connector.getPort(); int portRange = config().getPortRange(); int lastPort = portRange == 0 ? initPort : initPort + portRange - 1; for (port = initPort; port <= lastPort; port++) { connector.setPort(port); if (startJetty()) { if (log.isInfoEnabled()) log.info(startInfo()); return; } } U.warn(log, "Failed to start Jetty REST server (possibly all ports in range are in use) " + "[firstPort=" + initPort + ", lastPort=" + lastPort + ']'); }