Example usage for org.apache.hadoop.net DNS getDefaultHost

List of usage examples for org.apache.hadoop.net DNS getDefaultHost

Introduction

In this page you can find the example usage for org.apache.hadoop.net DNS getDefaultHost.

Prototype

public static String getDefaultHost(@Nullable String strInterface) throws UnknownHostException 

Source Link

Document

Returns the default (first) host name associated by the default nameserver with the address bound to the specified network interface

Usage

From source file:org.goldenorb.OrbPartitionManager.java

License:Apache License

/**
 * Constructor// w w  w . j  ava2 s  . com
 *
 * @param  OrbConfiguration conf
 * @param  Class<M> clazz
 */
public OrbPartitionManager(OrbConfiguration conf, Class<M> clazz) {
    this.conf = conf;
    this.processClass = clazz;

    try {
        ipAddress = DNS.getDefaultHost(this.conf.getOrbLauncherNetworkDevice());
        if (ipAddress.endsWith(".")) {
            ipAddress = ipAddress.substring(0, ipAddress.length() - 1);
        }
        logger.debug("setting ipAddress to " + ipAddress);
    } catch (UnknownHostException e) {
        logger.error(e.getMessage());
    }
}