/** * Gets the host, as either hostname or IP address, on which the Locator was bound and running. An * attempt is made to get the canonical hostname for IP address to which the Locator was bound for * accepting client requests. If the bind address is null or localhost is unknown, then a default * String value of "localhost/127.0.0.1" is returned. * * Note, this information is purely information and should not be used to re-construct state or * for other purposes. * * @return the hostname or IP address of the host running the Locator, based on the bind-address, * or 'localhost/127.0.0.1' if the bind address is null and localhost is unknown. * @see java.net.InetAddress * @see #getBindAddress() */ protected String getBindAddressAsString() { try { if (getBindAddress() != null) { return getBindAddress().getCanonicalHostName(); } InetAddress localhost = SocketCreator.getLocalHost(); return localhost.getCanonicalHostName(); } catch (UnknownHostException handled) { // Returning localhost/127.0.0.1 implies the bindAddress was null and no IP address for // localhost could be found return "localhost/127.0.0.1"; } }
private LocatorState statusWithPort() { try { LocatorStatusResponse response = statusLocator(getPort(), getBindAddress()); return new LocatorState(this, Status.ONLINE, response); } catch (Exception handled) { return createNoResponseState(handled, "Failed to connect to locator " + getBindAddressAsString() + "[" + getPort() + "]"); } }
private static String getLocatorLocation(LocatorLauncher launcher) { if (launcher.getPort() == null) { return launcher.getId(); } if (launcher.getBindAddress() == null) { return HostUtils.getLocatorId(HostUtils.getLocalHost(), launcher.getPort()); } return HostUtils.getLocatorId(launcher.getBindAddressAsString(), launcher.getPort()); }
if (launcher.getBindAddress() != null) { commandLine.add("--bind-address=" + launcher.getBindAddress().getCanonicalHostName());
LocatorStatusResponse response = statusLocator(getPort(), getBindAddress()); return new LocatorState(this, Status.ONLINE, response); } catch (Exception handled) {
ProcessType.LOCATOR, isForcing()); assertPortAvailable(getBindAddress(), getPort()); getBindAddress(), true, getDistributedSystemProperties(), getHostnameForClients()); } finally { ProcessLauncherContext.remove();
InetAddress bindAddr = locatorLauncher.getBindAddress(); if (bindAddr != null) { locatorHostName = bindAddr.getCanonicalHostName();