Java Code Examples for com.alibaba.dubbo.common.utils.NetUtils#getIpByHost()

The following examples show how to use com.alibaba.dubbo.common.utils.NetUtils#getIpByHost() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: AbstractProxyProtocol.java    From dubbo-2.6.5 with Apache License 2.0 5 votes vote down vote up
protected String getAddr(URL url) {
    String bindIp = url.getParameter(Constants.BIND_IP_KEY, url.getHost());
    if (url.getParameter(Constants.ANYHOST_KEY, false)) {
        bindIp = Constants.ANYHOST_VALUE;
    }
    return NetUtils.getIpByHost(bindIp) + ":" + url.getParameter(Constants.BIND_PORT_KEY, url.getPort());
}
 
Example 2
Source File: URL.java    From dubbo-2.6.5 with Apache License 2.0 3 votes vote down vote up
/**
 * Fetch IP address for this URL.
 *
 * Pls. note that IP should be used instead of Host when to compare with socket's address or to search in a map
 * which use address as its key.
 *
 * @return ip in string format
 */
public String getIp() {
    if (ip == null) {
        ip = NetUtils.getIpByHost(host);
    }
    return ip;
}
 
Example 3
Source File: URL.java    From dubbox with Apache License 2.0 3 votes vote down vote up
/**
 * 获取IP地址.
 * 
 * 请注意:
 * 如果和Socket的地址对比,
 * 或用地址作为Map的Key查找,
 * 请使用IP而不是Host,
 * 否则配置域名会有问题
 * 
 * @return ip
 */
public String getIp() {
    if (ip == null) {
        ip = NetUtils.getIpByHost(host);
    }
    return ip;
}
 
Example 4
Source File: URL.java    From dubbox-hystrix with Apache License 2.0 3 votes vote down vote up
/**
 * 获取IP地址.
 * 
 * 请注意:
 * 如果和Socket的地址对比,
 * 或用地址作为Map的Key查找,
 * 请使用IP而不是Host,
 * 否则配置域名会有问题
 * 
 * @return ip
 */
public String getIp() {
    if (ip == null) {
        ip = NetUtils.getIpByHost(host);
    }
    return ip;
}
 
Example 5
Source File: URL.java    From dubbo3 with Apache License 2.0 3 votes vote down vote up
/**
 * 获取IP地址.
 *
 * 请注意:
 * 如果和Socket的地址对比,
 * 或用地址作为Map的Key查找,
 * 请使用IP而不是Host,
 * 否则配置域名会有问题
 *
 * @return ip
 */
public String getIp() {
    if (ip == null) {
        ip = NetUtils.getIpByHost(host);
    }
    return ip;
}
 
Example 6
Source File: URL.java    From dubbox with Apache License 2.0 3 votes vote down vote up
/**
 * 获取IP地址.
 * 
 * 请注意:
 * 如果和Socket的地址对比,
 * 或用地址作为Map的Key查找,
 * 请使用IP而不是Host,
 * 否则配置域名会有问题
 * 
 * @return ip
 */
public String getIp() {
    if (ip == null) {
        ip = NetUtils.getIpByHost(host);
    }
    return ip;
}
 
Example 7
Source File: URL.java    From dubbox with Apache License 2.0 3 votes vote down vote up
/**
 * 获取IP地址.
 * 
 * 请注意:
 * 如果和Socket的地址对比,
 * 或用地址作为Map的Key查找,
 * 请使用IP而不是Host,
 * 否则配置域名会有问题
 * 
 * @return ip
 */
public String getIp() {
    if (ip == null) {
        ip = NetUtils.getIpByHost(host);
    }
    return ip;
}