/** * Create a socket address with the given host and port. The hostname * might be replaced with another host that was set via * {@link #addStaticResolution(String, String)}. The value of * hadoop.security.token.service.use_ip will determine whether the * standard java host resolver is used, or if the fully qualified resolver * is used. * @param host the hostname or IP use to instantiate the object * @param port the port number * @return InetSocketAddress */ public static InetSocketAddress createSocketAddrForHost(String host, int port) { String staticHost = getStaticResolution(host); String resolveHost = (staticHost != null) ? staticHost : host; InetSocketAddress addr; try { InetAddress iaddr = SecurityUtil.getByName(resolveHost); // if there is a static entry for the host, make the returned // address look like the original given host if (staticHost != null) { iaddr = InetAddress.getByAddress(host, iaddr.getAddress()); } addr = new InetSocketAddress(iaddr, port); } catch (UnknownHostException e) { addr = InetSocketAddress.createUnresolved(host, port); } return addr; }
if (getStaticResolution(hostname) != null) { hostname = getStaticResolution(hostname);
if (getStaticResolution(hostname) != null) { hostname = getStaticResolution(hostname);
/** * Create a socket address with the given host and port. The hostname * might be replaced with another host that was set via * {@link #addStaticResolution(String, String)}. The value of * hadoop.security.token.service.use_ip will determine whether the * standard java host resolver is used, or if the fully qualified resolver * is used. * @param host the hostname or IP use to instantiate the object * @param port the port number * @return InetSocketAddress */ public static InetSocketAddress createSocketAddrForHost(String host, int port) { String staticHost = getStaticResolution(host); String resolveHost = (staticHost != null) ? staticHost : host; InetSocketAddress addr; try { InetAddress iaddr = SecurityUtil.getByName(resolveHost); // if there is a static entry for the host, make the returned // address look like the original given host if (staticHost != null) { iaddr = InetAddress.getByAddress(host, iaddr.getAddress()); } addr = new InetSocketAddress(iaddr, port); } catch (UnknownHostException e) { addr = InetSocketAddress.createUnresolved(host, port); } return addr; }
String staticHost = getStaticResolution(host); String resolveHost = (staticHost != null) ? staticHost : host;
/** * Create a socket address with the given host and port. The hostname * might be replaced with another host that was set via * {@link #addStaticResolution(String, String)}. The value of * hadoop.security.token.service.use_ip will determine whether the * standard java host resolver is used, or if the fully qualified resolver * is used. * @param host the hostname or IP use to instantiate the object * @param port the port number * @return InetSocketAddress */ public static InetSocketAddress createSocketAddrForHost(String host, int port) { String staticHost = getStaticResolution(host); String resolveHost = (staticHost != null) ? staticHost : host; InetSocketAddress addr; try { InetAddress iaddr = SecurityUtil.getByName(resolveHost); // if there is a static entry for the host, make the returned // address look like the original given host if (staticHost != null) { iaddr = InetAddress.getByAddress(host, iaddr.getAddress()); } addr = new InetSocketAddress(iaddr, port); } catch (UnknownHostException e) { addr = InetSocketAddress.createUnresolved(host, port); } return addr; }
/** * Create a socket address with the given host and port. The hostname * might be replaced with another host that was set via * {@link #addStaticResolution(String, String)}. The value of * hadoop.security.token.service.use_ip will determine whether the * standard java host resolver is used, or if the fully qualified resolver * is used. * @param host the hostname or IP use to instantiate the object * @param port the port number * @return InetSocketAddress */ public static InetSocketAddress createSocketAddrForHost(String host, int port) { String staticHost = getStaticResolution(host); String resolveHost = (staticHost != null) ? staticHost : host; InetSocketAddress addr; try { InetAddress iaddr = SecurityUtil.getByName(resolveHost); // if there is a static entry for the host, make the returned // address look like the original given host if (staticHost != null) { iaddr = InetAddress.getByAddress(host, iaddr.getAddress()); } addr = new InetSocketAddress(iaddr, port); } catch (UnknownHostException e) { addr = InetSocketAddress.createUnresolved(host, port); } return addr; }
@BeforeClass public static void initializeDummyHostnameResolution() throws Exception { String previousIpAddress; for (String hostName : dummyHostNames) { if (null != (previousIpAddress = NetUtils.getStaticResolution(hostName))) { savedStaticResolution.put(hostName, previousIpAddress); } NetUtils.addStaticResolution(hostName, anyIpAddress); } }
@BeforeClass public static void initializeDummyHostnameResolution() throws Exception { String previousIpAddress; for (String hostName : dummyHostNames) { if (null != (previousIpAddress = NetUtils.getStaticResolution(hostName))) { savedStaticResolution.put(hostName, previousIpAddress); } NetUtils.addStaticResolution(hostName, anyIpAddress); } }
@BeforeClass public static void initializeDummyHostnameResolution() throws Exception { String previousIpAddress; for (String hostName : dummyHostNames) { if (null != (previousIpAddress = NetUtils.getStaticResolution(hostName))) { savedStaticResolution.put(hostName, previousIpAddress); } NetUtils.addStaticResolution(hostName, anyIpAddress); } }
if (NetUtils.getStaticResolution(ttStatus.getHost()) != null) { host = NetUtils.getStaticResolution(ttStatus.getHost()); } else { host = ttStatus.getHost();
if (NetUtils.getStaticResolution(ttStatus.getHost()) != null) { host = NetUtils.getStaticResolution(ttStatus.getHost()); } else { host = ttStatus.getHost();
if (NetUtils.getStaticResolution(ttStatus.getHost()) != null) { host = NetUtils.getStaticResolution(ttStatus.getHost()); } else { host = ttStatus.getHost();