Package com.datastax.driver.core.policies

Examples of com.datastax.driver.core.policies.RoundRobinPolicy


        }
    }

    @Test(groups = "long")
    public void testRFThreeTokenAware() throws Throwable {
        Cluster.Builder builder = Cluster.builder().withLoadBalancingPolicy(new TokenAwarePolicy(new RoundRobinPolicy()));
        CCMBridge.CCMCluster c = CCMBridge.buildCluster(3, builder);
        try {

            createSchema(c.session, 3);
            init(c, 12, ConsistencyLevel.TWO);
View Full Code Here


    }


    @Test(groups = "long")
    public void testRFOneDowngradingCL() throws Throwable {
        Cluster.Builder builder = Cluster.builder().withLoadBalancingPolicy(new TokenAwarePolicy(new RoundRobinPolicy())).withRetryPolicy(DowngradingConsistencyRetryPolicy.INSTANCE);
        CCMBridge.CCMCluster c = CCMBridge.buildCluster(3, builder);
        try {

            createSchema(c.session, 1);
            init(c, 12, ConsistencyLevel.ONE);
View Full Code Here

        }
    }

    @Test(groups = "long")
    public void testRFTwoDowngradingCL() throws Throwable {
        Cluster.Builder builder = Cluster.builder().withLoadBalancingPolicy(new TokenAwarePolicy(new RoundRobinPolicy())).withRetryPolicy(DowngradingConsistencyRetryPolicy.INSTANCE);
        CCMBridge.CCMCluster c = CCMBridge.buildCluster(3, builder);
        try {

            createSchema(c.session, 2);
            init(c, 12, ConsistencyLevel.TWO);
View Full Code Here

        }
    }

    @Test(groups = "long")
    public void testRFThreeRoundRobinDowngradingCL() throws Throwable {
        Cluster.Builder builder = Cluster.builder().withLoadBalancingPolicy(new RoundRobinPolicy()).withRetryPolicy(DowngradingConsistencyRetryPolicy.INSTANCE);
        testRFThreeDowngradingCL(builder);
    }
View Full Code Here

        testRFThreeDowngradingCL(builder);
    }

    @Test(groups = "long")
    public void testRFThreeTokenAwareDowngradingCL() throws Throwable {
        Cluster.Builder builder = Cluster.builder().withLoadBalancingPolicy(new TokenAwarePolicy(new RoundRobinPolicy())).withRetryPolicy(DowngradingConsistencyRetryPolicy.INSTANCE);
        testRFThreeDowngradingCL(builder);
    }
View Full Code Here

        }
    }

    @Test(groups = "long")
    public void testRFThreeDowngradingCLTwoDCs() throws Throwable {
        Cluster.Builder builder = Cluster.builder().withLoadBalancingPolicy(new TokenAwarePolicy(new RoundRobinPolicy())).withRetryPolicy(DowngradingConsistencyRetryPolicy.INSTANCE);
        CCMBridge.CCMCluster c = CCMBridge.buildCluster(3, 3, builder);
        try {

            createMultiDCSchema(c.session, 3, 3);
            init(c, 12, ConsistencyLevel.TWO);
View Full Code Here

    }

    private LoadBalancingPolicy getLoadBalancingPolicy() {
        String policy = System.getProperty(LOAD_BALANCING);
        if (policy == null || policy.equals("RoundRobin")) {
            return new RoundRobinPolicy();
        }
        if (policy.equals("DCAwareRoundRobin")) {
            String dataCenter = System.getProperty(DATA_CENTER);
            if (dataCenter == null) {
                LOG.warn(policy + " was specified for " + LOAD_BALANCING + " but " + DATA_CENTER + " is undefined." +
                    "Reverting to RoundRobin load balancing policy.");
                return new RoundRobinPolicy();
            } else {
                return new DCAwareRoundRobinPolicy(dataCenter);
            }
        }
        LOG.warn(policy + " is not a supported load balancing policy. Reverting to RoundRobin load balancing policy.");

        return new RoundRobinPolicy();
    }
View Full Code Here

    }
    @Provides
    @Named("pooledmetacluster")
    Cluster providePooledCluster(@Named("paas.cassclient") String clientType,@Named("paas.metacluster") String clustername) {
        if (clientType.equals("cql")) {
        Cluster cluster = Cluster.builder().withLoadBalancingPolicy(new TokenAwarePolicy(new RoundRobinPolicy())).addContactPoint(clustername).build();
//        Cluster cluster = Cluster.builder().addContactPoint(clustername).build();
        return cluster;
        }else {
            return null;
        }
View Full Code Here

        } else {
            CassandraStorage cassStorage = new CassandraStorage(storageConf);
            if (clientType.equals(CLIENTTYPE.ASTYANAX.getType())) {
                return new AstyanaxCassandraConnection(cassStorage.getCluster(), db, hs);
            } else {
            Cluster cluster = Cluster.builder().withLoadBalancingPolicy(new TokenAwarePolicy(new RoundRobinPolicy())).addContactPoint(cassStorage.getCluster()).build();
            return new CassandraConnection(cluster);
            }
        }
    }
View Full Code Here

    }
    @Provides
    @Named("pooledmetacluster")
    Cluster providePooledCluster(@Named("staash.cassclient") String clientType,@Named("staash.metacluster") String clustername) {
        if (clientType.equals("cql")) {
        Cluster cluster = Cluster.builder().withLoadBalancingPolicy(new TokenAwarePolicy(new RoundRobinPolicy())).addContactPoint(clustername).build();
        return cluster;
        }else {
            return null;
        }
    }
View Full Code Here

TOP

Related Classes of com.datastax.driver.core.policies.RoundRobinPolicy

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.