Example usage for org.apache.cassandra.tools.nodetool SetHostStat SetHostStat

List of usage examples for org.apache.cassandra.tools.nodetool SetHostStat SetHostStat

Introduction

In this page you can find the example usage for org.apache.cassandra.tools.nodetool SetHostStat SetHostStat.

Prototype

public SetHostStat(boolean resolveIp) 

Source Link

Usage

From source file:com.wenyu.clustertools.Ring.java

License:Apache License

public static SortedMap<String, SetHostStat> getOwnershipByDc(ClusterToolNodeProbe probe, boolean resolveIp,
            Map<String, String> tokenToEndpoint, Map<InetAddress, Float> ownerships) {
        SortedMap<String, SetHostStat> ownershipByDc = Maps.newTreeMap();
        EndpointSnitchInfoMBean epSnitchInfo = probe.getEndpointSnitchInfoProxy();
        try {//from w w w. j  a  v a2s  . c om
            for (Map.Entry<String, String> tokenAndEndPoint : tokenToEndpoint.entrySet()) {
                String dc = epSnitchInfo.getDatacenter(tokenAndEndPoint.getValue());
                if (!ownershipByDc.containsKey(dc))
                    ownershipByDc.put(dc, new SetHostStat(resolveIp));
                ownershipByDc.get(dc).add(tokenAndEndPoint.getKey(), tokenAndEndPoint.getValue(), ownerships);
            }
        } catch (UnknownHostException e) {
            throw new RuntimeException(e);
        }
        return ownershipByDc;
    }