use of com.navercorp.pinpoint.plugin.elasticsearch.accessor.HttpHostInfoAccessor in project pinpoint by naver.
the class HighLevelConnectInterceptor method getHostList.
private List<String> getHostList(Object arg) {
if (!(arg instanceof RestClient)) {
return Collections.emptyList();
}
final List<String> hostList = new ArrayList<>();
HttpHost[] httpHosts = null;
if (arg instanceof HttpHostInfoAccessor) {
httpHosts = ((HttpHostInfoAccessor) arg)._$PINPOINT$_getHttpHostInfo();
}
// v6.4 ~
if (httpHosts == null) {
for (Node node : ((RestClient) arg).getNodes()) {
final String hostAddress = HostAndPort.toHostAndPortString(node.getHost().getHostName(), node.getHost().getPort());
hostList.add(hostAddress);
}
} else {
// v6.0 ~ 6.3
for (HttpHost httpHost : httpHosts) {
final String hostAddress = HostAndPort.toHostAndPortString(httpHost.getHostName(), httpHost.getPort());
hostList.add(hostAddress);
}
}
return hostList;
}
Aggregations