Java Code Examples for org.apache.hadoop.net.NetUtils.makeSocketAddr()

The following are Jave code examples for showing how to use makeSocketAddr() of the org.apache.hadoop.net.NetUtils class. You can vote up the examples you like. Your votes will be used in our system to get more good examples.
Example 1
Project: spark_deep   File: Client.java   Source Code and License Vote up 5 votes
/**
 * Update the server address if the address corresponding to the host
 * name has changed.
 *
 * @return true if an addr change was detected.
 * @throws IOException
 *             when the hostname cannot be resolved.
 */
private synchronized boolean updateAddress() throws IOException {
	// Do a fresh lookup with the old host name.
	InetSocketAddress currentAddr = NetUtils.makeSocketAddr(server.getHostName(), server.getPort());

	if (!server.equals(currentAddr)) {
		LOG.warn("Address change detected. Old: " + server.toString() + " New: " + currentAddr.toString());
		server = currentAddr;
		return true;
	}
	return false;
}