Package com.datastax.driver.core.policies

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


        }
    }

    @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(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);
      builder.withPort(this.nativeTransportPort);
    }
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

            break;
        }

        if (loadBalancingPolicy != null && Boolean.valueOf(isTokenAware))
        {
            loadBalancingPolicy = new TokenAwarePolicy(loadBalancingPolicy);
        }
        else if (loadBalancingPolicy != null && Boolean.valueOf(isLatencyAware))
        {
            loadBalancingPolicy = LatencyAwarePolicy.builder(loadBalancingPolicy).build();
        }
View Full Code Here

   
    switch (asConfig.getConnectionPoolType()) {
    case ROUND_ROBIN:
        return new RoundRobinPolicy();
    case TOKEN_AWARE:
        return new TokenAwarePolicy(new RoundRobinPolicy());
    case BAG:
      throw new RuntimeException("Unsupported connection pool type, use ROUND_ROBIN or TOKEN_AWARE");
    default:
      return new RoundRobinPolicy();
    }
View Full Code Here

TOP

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

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.