Package org.apache.cassandra.locator

Examples of org.apache.cassandra.locator.EndpointSnitchInfoMBean


        return proxy;
    }

    public EndpointSnitchInfoMBean getEpSnitchProxy(MBeanServerConnection mbeanConn)
    {
        EndpointSnitchInfoMBean proxy = null;
        try
        {
            ObjectName name = new ObjectName(epSnitchObjName);
            proxy = JMX.newMBeanProxy(mbeanConn, name, EndpointSnitchInfoMBean.class);
        }
View Full Code Here


    {
        CassandraClient seedClient = null;
        Map<String, String> tokenMap = null;
        IPartitioner<?> partitioner = null;
        Multimap<String, String> endpointMap = HashMultimap.create();
        EndpointSnitchInfoMBean epSnitchProxy = getEpSnitchProxy(jmxConn.getMbeanServerConn());

        try
        {
            seedClient = getThriftClient(thriftHost, thriftPort, thriftFramed);
            tokenMap = seedClient.describe_token_map();

            for (Map.Entry<String, String> entry : tokenMap.entrySet())
            {
                String endpoint = entry.getValue(), token = entry.getKey();
                try
                {
                    if (onlyDc != null)
                    {
                        if (onlyDc.equals(epSnitchProxy.getDatacenter(endpoint)))
                            endpointMap.put(endpoint, token);
                    }
                    else
                        endpointMap.put(endpoint, token);
                }
View Full Code Here

    private static Map<String, SetHostStat> getOwnershipByDc(NodeProbe probe, boolean resolveIp,
                                                             Map<String, String> tokenToEndpoint,
                                                             Map<InetAddress, Float> ownerships)
    {
        Map<String, SetHostStat> ownershipByDc = Maps.newLinkedHashMap();
        EndpointSnitchInfoMBean epSnitchInfo = probe.getEndpointSnitchInfoProxy();
        try
        {
            for (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);
            }
        }
View Full Code Here

        private Map<String, Map<InetAddress, Float>> getOwnershipByDc(Map<InetAddress, Float> ownerships)
        throws UnknownHostException
        {
            Map<String, Map<InetAddress, Float>> ownershipByDc = Maps.newLinkedHashMap();
            EndpointSnitchInfoMBean epSnitchInfo = probe.getEndpointSnitchInfoProxy();

            for (Map.Entry<InetAddress, Float> ownership : ownerships.entrySet())
            {
                String dc = epSnitchInfo.getDatacenter(ownership.getKey().getHostAddress());
                if (!ownershipByDc.containsKey(dc))
                    ownershipByDc.put(dc, new LinkedHashMap<InetAddress, Float>());
                ownershipByDc.get(dc).put(ownership.getKey(), ownership.getValue());
            }
View Full Code Here

        return proxy;
    }

    private EndpointSnitchInfoMBean getEpSnitchProxy(MBeanServerConnection mbeanConn)
    {
        EndpointSnitchInfoMBean proxy;
        try
        {
            ObjectName name = new ObjectName(epSnitchObjName);
            proxy = JMX.newMBeanProxy(mbeanConn, name, EndpointSnitchInfoMBean.class);
        }
View Full Code Here

     */
    public void shuffle(boolean enable, String onlyDc) throws ShuffleError
    {
        Map<String, String> tokenMap;
        Multimap<String, String> endpointMap = HashMultimap.create();
        EndpointSnitchInfoMBean epSnitchProxy = getEpSnitchProxy(jmxConn.getMbeanServerConn());

        try
        {
            CassandraClient seedClient = getThriftClient(thriftHost);
            tokenMap = seedClient.describe_token_map();

            for (Map.Entry<String, String> entry : tokenMap.entrySet())
            {
                String endpoint = entry.getValue(), token = entry.getKey();
                try
                {
                    if (onlyDc != null)
                    {
                        if (onlyDc.equals(epSnitchProxy.getDatacenter(endpoint)))
                            endpointMap.put(endpoint, token);
                    }
                    else
                        endpointMap.put(endpoint, token);
                }
View Full Code Here

    private static Map<String, SetHostStat> getOwnershipByDc(NodeProbe probe, boolean resolveIp,
                                                             Map<String, String> tokenToEndpoint,
                                                             Map<InetAddress, Float> ownerships)
    {
        Map<String, SetHostStat> ownershipByDc = Maps.newLinkedHashMap();
        EndpointSnitchInfoMBean epSnitchInfo = probe.getEndpointSnitchInfoProxy();
        try
        {
            for (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);
            }
        }
View Full Code Here

        private Map<String, Map<InetAddress, Float>> getOwnershipByDc(Map<InetAddress, Float> ownerships)
        throws UnknownHostException
        {
            Map<String, Map<InetAddress, Float>> ownershipByDc = Maps.newLinkedHashMap();
            EndpointSnitchInfoMBean epSnitchInfo = probe.getEndpointSnitchInfoProxy();

            for (Map.Entry<InetAddress, Float> ownership : ownerships.entrySet())
            {
                String dc = epSnitchInfo.getDatacenter(ownership.getKey().getHostAddress());
                if (!ownershipByDc.containsKey(dc))
                    ownershipByDc.put(dc, new LinkedHashMap<InetAddress, Float>());
                ownershipByDc.get(dc).put(ownership.getKey(), ownership.getValue());
            }
View Full Code Here

        private Map<String, Map<InetAddress, Float>> getOwnershipByDc(Map<InetAddress, Float> ownerships)
        throws UnknownHostException
        {
            Map<String, Map<InetAddress, Float>> ownershipByDc = Maps.newLinkedHashMap();
            EndpointSnitchInfoMBean epSnitchInfo = probe.getEndpointSnitchInfoProxy();

            for (Map.Entry<InetAddress, Float> ownership : ownerships.entrySet())
            {
                String dc = epSnitchInfo.getDatacenter(ownership.getKey().getHostAddress());
                if (!ownershipByDc.containsKey(dc))
                    ownershipByDc.put(dc, new LinkedHashMap<InetAddress, Float>());
                ownershipByDc.get(dc).put(ownership.getKey(), ownership.getValue());
            }
View Full Code Here

        private Map<String, Map<InetAddress, Float>> getOwnershipByDc(Map<InetAddress, Float> ownerships)
        throws UnknownHostException
        {
            Map<String, Map<InetAddress, Float>> ownershipByDc = Maps.newLinkedHashMap();
            EndpointSnitchInfoMBean epSnitchInfo = probe.getEndpointSnitchInfoProxy();

            for (Map.Entry<InetAddress, Float> ownership : ownerships.entrySet())
            {
                String dc = epSnitchInfo.getDatacenter(ownership.getKey().getHostAddress());
                if (!ownershipByDc.containsKey(dc))
                    ownershipByDc.put(dc, new LinkedHashMap<InetAddress, Float>());
                ownershipByDc.get(dc).put(ownership.getKey(), ownership.getValue());
            }
View Full Code Here

TOP

Related Classes of org.apache.cassandra.locator.EndpointSnitchInfoMBean

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.