Package org.apache.cassandra.locator

Examples of org.apache.cassandra.locator.EndPointSnitch


    public StorageService()
    {
        init();
        uptime_ = System.currentTimeMillis();       
        storageLoadBalancer_ = new StorageLoadBalancer(this);
        endPointSnitch_ = new EndPointSnitch();
       
        /* register the verb handlers */
        MessagingService.getMessagingInstance().registerVerbHandlers(StorageService.tokenVerbHandler_, new TokenUpdateVerbHandler());
        MessagingService.getMessagingInstance().registerVerbHandlers(StorageService.binaryVerbHandler_, new BinaryVerbHandler());
        MessagingService.getMessagingInstance().registerVerbHandlers(StorageService.loadVerbHandler_, new LoadVerbHandler());
View Full Code Here


        allNodes_ = new HashSet<EndPoint>(allNodes);
    }
   
    public void assignReplicas()
    {
        IEndPointSnitch snitch = new EndPointSnitch();
        Set<EndPoint> allNodes = new HashSet<EndPoint>(allNodes_);
        Map<EndPoint, Integer> nOccurences = new HashMap<EndPoint, Integer>();
       
        for ( EndPoint node : allNodes_ )
        {
            nOccurences.put(node, 1);
        }
       
        for ( EndPoint node : allNodes_ )
        {
            allNodes.remove(node);
            for ( EndPoint choice : allNodes )
            {
                List<EndPoint> replicasChosen = nodeToReplicaMap_.get(node);
                if ( replicasChosen == null || replicasChosen.size() < DatabaseDescriptor.getReplicationFactor() - 1 )
                {
                    try
                    {
                        if ( !snitch.isInSameDataCenter(node, choice) )
                        {
                            if ( replicasChosen == null )
                            {
                                replicasChosen = new ArrayList<EndPoint>();
                                nodeToReplicaMap_.put(node, replicasChosen);
View Full Code Here

TOP

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

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.