Helper method to get the bind hostname for a given service.

@param service the service name
@param conf Alluxio configuration
@return the InetSocketAddress the service will bind to
778771
public static InetSocketAddress getBindAddress(ServiceType service, AlluxioConfiguration conf) {
    int port = getPort(service, conf);
    assertValidPort(port);
    return new InetSocketAddress(getBindHost(service, conf), getPort(service, conf));
  }
1362008
public static String getHostname(InetSocketAddress addr) {
        return PlatformDependent.javaVersion() >= 7 ? addr.getHostString() : addr.getHostName();
    }
1268067
public synchronized final String getHost() {
        if (host == null) {
            InetSocketAddress adr = getEndpointAddress();
            
            if ( adr != null && !adr.isUnresolved()) {
                host = getEndpointAddress().getHostName();
            }
        }

        return host;
    }
416099
public void bind(InetSocketAddress inetSocketAddress) throws IOException {
    if (inetSocketAddress == null) {
      throw new IllegalArgumentException("Null inetSocketAddress");
    }
    setLocalSocketAddress(inetSocketAddress);
    start();
  }
1184876
private static QName getServiceName(Server server) {
        QName serviceName;
        String bindingId = getBindingId(server);
        EndpointInfo eInfo = server.getEndpoint().getEndpointInfo();
        
        if (JAXRS_BINDING_ID.equals(bindingId)) {
            serviceName = eInfo.getName();
        } else {
            ServiceInfo serviceInfo = eInfo.getService();
            serviceName =  serviceInfo.getName();
        }
        return serviceName;
    }
44029
protected RegisteredService getRegisteredServiceForConsent(final RequestContext requestContext, final Service service) {
        val serviceToUse = this.authenticationRequestServiceSelectionStrategies.resolveService(service);
        val registeredService = this.servicesManager.findServiceBy(serviceToUse);
        RegisteredServiceAccessStrategyUtils.ensureServiceAccessIsAllowed(service, registeredService);
        return registeredService;
    }
213958
public static List<InetSocketAddress> getAddresses(Configuration conf,
      Collection<String> serviceIds, String defaultAddress, String... keys) {
    Collection<String> nameserviceIds = getNameServiceIds(conf);
    List<InetSocketAddress> isas = new ArrayList<InetSocketAddress>();

    // Configuration with a single namenode
    if (nameserviceIds == null || nameserviceIds.isEmpty()) {
      String address = getConfValue(defaultAddress, null, conf, keys);
      if (address == null) {
        return null;
      }
      isas.add(NetUtils.createSocketAddr(address));
    } else {
      // Get the namenodes for all the configured nameServiceIds
      for (String nameserviceId : nameserviceIds) {
        String address = getConfValue(null, nameserviceId, conf, keys);
        if (address == null) {
          return null;
        }
        isas.add(NetUtils.createSocketAddr(address));
      }
    }
    return isas;
  }
888050
public static String getContainerName(String hostname,
      boolean serviceRequired) throws IOException {
    int i = hostname.lastIndexOf(".");
    if (i <= 0) {
      if (serviceRequired) {
        throw badHostName(hostname);
      }
      return hostname;
    }
    return hostname.substring(0, i);
  }
382509
public InetAddress
getAddress() {
	try {
		if (name == null)
			return InetAddress.getByAddress(toArray(addr));
		else
			return InetAddress.getByAddress(name.toString(),
							toArray(addr));
	} catch (UnknownHostException e) {
		return null;
	}
}
665032
public void bind(InetSocketAddress address) throws IOException {
        if (listener != null) {
            listener.close();
            listener = null;
        }
        listener = ServerSocketChannel.open();
        listener.socket().bind(address);
    }
1362892
def _get_service_bindings(self, service_name):
        
        instance = self.get_instance(service_name)
        return self.api.get(instance['service_bindings_url'])
1149857
private static ClientConfiguration initializeOSSClientConfig(AlluxioConfiguration alluxioConf) {
    ClientConfiguration ossClientConf = new ClientConfiguration();
    ossClientConf
        .setConnectionTimeout((int) alluxioConf.getMs(PropertyKey.UNDERFS_OSS_CONNECT_TIMEOUT));
    ossClientConf
        .setSocketTimeout((int) alluxioConf.getMs(PropertyKey.UNDERFS_OSS_SOCKET_TIMEOUT));
    ossClientConf.setConnectionTTL(alluxioConf.getLong(PropertyKey.UNDERFS_OSS_CONNECT_TTL));
    ossClientConf.setMaxConnections(alluxioConf.getInt(PropertyKey.UNDERFS_OSS_CONNECT_MAX));
    return ossClientConf;
  }
176872
public InetAddress getInetAddress() throws UnknownHostException{
     if(ip!=null) return ip;

     return (ip=InetAddress.getByName(host));
   }
307661
public static List<InetSocketAddress> getEmbeddedJournalAddresses(AlluxioConfiguration conf,
      ServiceType serviceType) {
    Preconditions.checkState(
        serviceType == ServiceType.MASTER_RAFT || serviceType == ServiceType.JOB_MASTER_RAFT);
    if (serviceType == ServiceType.MASTER_RAFT) {
      return getMasterEmbeddedJournalAddresses(conf);
    }
    return getJobMasterEmbeddedJournalAddresses(conf);
  }
1075844
public static InetAddress getAddress(String host) throws UnknownHostException {
        if (timeToClean()) {
            synchronized (storedAddresses) {
                if (timeToClean()) {
                    cleanOldAddresses();
                }
            }
        }
        Pair<InetAddress, Long> cachedAddress;
        synchronized (storedAddresses) {
            cachedAddress = storedAddresses.get(host);
        }
        if (cachedAddress != null) {
            //host DNS entry was cached
            InetAddress address = cachedAddress.getFirst();
            if (address == null) {
                throw new UnknownHostException("Could not find host " + host + " (cached response)");
            } else {
                return address;
            }
        } else {
            //host DNS entry was not cached
            fetchDnsAddressLock.acquireUninterruptibly();
            try {
                InetAddress addr = InetAddress.getByName(host);
                synchronized (storedAddresses) {
                    storedAddresses.put(host, new Pair<>(addr, System.currentTimeMillis()));
                }
                return addr;
            } catch (UnknownHostException exp) {
                synchronized (storedAddresses) {
                    storedAddresses.put(host, new Pair<InetAddress, Long>(null, System.currentTimeMillis()));
                }
                Log.i("[Dns lookup] " + host + " --> not found");
                throw exp;
            } finally {
                fetchDnsAddressLock.release();
            }

        }
    }
1301693
public static InetSocketAddress getAddress (String hostname, int port)
    {
        return StringUtil.isBlank(hostname) ?
            new InetSocketAddress(port) : new InetSocketAddress(hostname, port);
    }
79605
public static InetSocketAddress getAddress(Configuration conf) {
    String addr = conf.get(JournalConfigKeys.DFS_JOURNALNODE_HTTP_ADDRESS_KEY,
        JournalConfigKeys.DFS_JOURNALNODE_HTTP_ADDRESS_DEFAULT);
    return NetUtils.createSocketAddr(addr,
        JournalConfigKeys.DFS_JOURNALNODE_HTTP_PORT_DEFAULT);
  }