Package com.datastax.driver.core.policies

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


    }

    @Test(groups = "long")
    public void DCAwareRoundRobinTest() throws Throwable {

        Cluster.Builder builder = Cluster.builder().withLoadBalancingPolicy(new DCAwareRoundRobinPolicy("dc2"));
        CCMBridge.CCMCluster c = CCMBridge.buildCluster(2, 2, builder);
        try {

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


    }

    @Test(groups = "long")
    public void DCAwareRoundRobinTest2() throws Throwable {

        Cluster.Builder builder = Cluster.builder().withLoadBalancingPolicy(new DCAwareRoundRobinPolicy("dc1"));
        CCMBridge.CCMCluster c = CCMBridge.buildCluster(2, 2, builder);
        try {

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

    }

    @Test(groups = "long")
    public void dcAwareRoundRobinTestWithOneRemoteHost() throws Throwable {

        Cluster.Builder builder = Cluster.builder().withLoadBalancingPolicy(new DCAwareRoundRobinPolicy("dc2", 1));
        CCMBridge.CCMCluster c = CCMBridge.buildCluster(2, 2, builder);
        try {

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

        }
    }

    @Test(groups = "long")
    public void testRFThreeDowngradingCLTwoDCsDCAware() throws Throwable {
        Cluster.Builder builder = Cluster.builder().withLoadBalancingPolicy(new TokenAwarePolicy(new DCAwareRoundRobinPolicy("dc2"))).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

            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

      builder.addContactPoint(contactPoint);
    }
    if(localDatacenter != null) {
      logger.info("Creating with DCAwareRoundRobinPolicy: {}", localDatacenter);
      if(loadBalancingPolicy == null) {
        loadBalancingPolicy = new DCAwareRoundRobinPolicy(localDatacenter);
      }
      builder.withLoadBalancingPolicy(new TokenAwarePolicy(loadBalancingPolicy));
    }
    if(this.nativeTransportPort != null) {
      logger.debug("Setting native transport port to {}", this.nativeTransportPort);
View Full Code Here

                if (localDc == null || localDc.isEmpty()) {
                    throw new IllegalArgumentException("A DCAwareRoundRobinPolicy requires a local_dc in configuration.");
                }

                loadBalancingPolicy = new DCAwareRoundRobinPolicy(localDc, usedHostsPerRemoteDc);

            } else {

                Class<?> clazz;
                try {
View Full Code Here

                if (localDc == null || localDc.isEmpty()) {
                    throw new IllegalArgumentException("A DCAwareRoundRobinPolicy requires a local_dc in configuration.");
                }

                loadBalancingPolicy = new DCAwareRoundRobinPolicy(localDc, usedHostsPerRemoteDc);

            } else {

                Class<?> clazz;
                try {
View Full Code Here

    {
        this.host = host;
        this.port = port;
        this.encryptionOptions = encryptionOptions;
        if (settings.node.isWhiteList)
            whitelist = new WhiteListPolicy(new DCAwareRoundRobinPolicy(), settings.node.resolveAll(settings.port.nativePort));
        else
            whitelist = null;
    }
View Full Code Here

                if (localDc == null || localDc.isEmpty()) {
                    throw new IllegalArgumentException("A DCAwareRoundRobinPolicy requires a local_dc in configuration.");
                }

                builder.withLoadBalancingPolicy(new DCAwareRoundRobinPolicy(localDc, usedHostsPerRemoteDc));

            } else {

                Class<?> clazz;
                try {
View Full Code Here

TOP

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

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.