本文整理汇总了Java中org.elasticsearch.hadoop.util.StringUtils.parseIpAddress方法的典型用法代码示例。如果您正苦于以下问题:Java StringUtils.parseIpAddress方法的具体用法?Java StringUtils.parseIpAddress怎么用?Java StringUtils.parseIpAddress使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.elasticsearch.hadoop.util.StringUtils
的用法示例。
在下文中一共展示了StringUtils.parseIpAddress方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: Node
import org.elasticsearch.hadoop.util.StringUtils; //导入方法依赖的package包/类
public Node(String id, Map<String, Object> data) {
this.id = id;
name = data.get("name").toString();
Object http = data.get("http_address");
hasHttp = (http != null);
Map<String, Object> attributes = (Map<String, Object>) data.get("attributes");
if (attributes != null) {
isClient = ("false".equals(attributes.get("data")) && "false".equals(attributes.get("master")));
isData = !"false".equals(attributes.get("data"));
}
if (!hasHttp) {
return;
}
IpAndPort ip = StringUtils.parseIpAddress(http.toString());
ipAddress = ip.ip;
httpPort = ip.port;
}
示例2: start
import org.elasticsearch.hadoop.util.StringUtils; //导入方法依赖的package包/类
public void start() {
node.start();
// find out port
String localNodeId = node.client().admin().cluster().prepareState().get().getState().getNodes().getLocalNodeId();
String value = node.client().admin().cluster().prepareNodesInfo(localNodeId).get().iterator().next().getHttp().address().publishAddress().toString();
ipAndPort = StringUtils.parseIpAddress(value);
}