Skip to content

Commit

Permalink
C* driver downgraded back to 2.1.6
Browse files Browse the repository at this point in the history
  • Loading branch information
EinsamHauer committed May 24, 2017
1 parent ba83d2d commit d1cf653
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 7 deletions.
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@
<dependency>
<groupId>com.datastax.cassandra</groupId>
<artifactId>cassandra-driver-core</artifactId>
<version>3.1.0</version>
<version>2.1.6</version>
</dependency>
<dependency>
<groupId>net.jpountz.lz4</groupId>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
package net.iponweb.disthene.service.store;

import com.datastax.driver.core.*;
import com.datastax.driver.core.policies.DCAwareRoundRobinPolicy;
import com.datastax.driver.core.policies.TokenAwarePolicy;
import com.google.common.util.concurrent.MoreExecutors;
import net.engio.mbassy.bus.MBassador;
import net.engio.mbassy.listener.Handler;
Expand All @@ -10,7 +12,6 @@
import net.iponweb.disthene.config.StoreConfiguration;
import net.iponweb.disthene.events.DistheneEvent;
import net.iponweb.disthene.events.MetricStoreEvent;
import net.iponweb.disthene.util.CassandraLoadBalancingPolicies;
import org.apache.log4j.Logger;

import java.util.ArrayList;
Expand Down Expand Up @@ -50,16 +51,16 @@ public CassandraService(StoreConfiguration storeConfiguration, MBassador<Disthen
PoolingOptions poolingOptions = new PoolingOptions();
poolingOptions.setMaxConnectionsPerHost(HostDistance.LOCAL, storeConfiguration.getMaxConnections());
poolingOptions.setMaxConnectionsPerHost(HostDistance.REMOTE, storeConfiguration.getMaxConnections());
poolingOptions.setMaxRequestsPerConnection(HostDistance.REMOTE, storeConfiguration.getMaxRequests());
poolingOptions.setMaxRequestsPerConnection(HostDistance.LOCAL, storeConfiguration.getMaxRequests());
poolingOptions.setMaxSimultaneousRequestsPerConnectionThreshold(HostDistance.REMOTE, storeConfiguration.getMaxRequests());
poolingOptions.setMaxSimultaneousRequestsPerConnectionThreshold(HostDistance.LOCAL, storeConfiguration.getMaxRequests());

Cluster.Builder builder = Cluster.builder()
.withSocketOptions(socketOptions)
.withCompression(ProtocolOptions.Compression.LZ4)
.withLoadBalancingPolicy(CassandraLoadBalancingPolicies.getLoadBalancingPolicy(storeConfiguration.getLoadBalancingPolicyName()))
.withLoadBalancingPolicy(new TokenAwarePolicy(new DCAwareRoundRobinPolicy(), false))
.withPoolingOptions(poolingOptions)
.withQueryOptions(new QueryOptions().setConsistencyLevel(ConsistencyLevel.ONE))
.withProtocolVersion(ProtocolVersion.valueOf(storeConfiguration.getProtocolVersion()))
.withProtocolVersion(ProtocolVersion.V2)
.withPort(storeConfiguration.getPort());

if ( storeConfiguration.getUserName() != null && storeConfiguration.getUserPassword() != null ) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ public static LoadBalancingPolicy getLoadBalancingPolicy(String policy) {
loadBalancingPolicy = new TokenAwarePolicy(new RoundRobinPolicy());
break;
case tokenDcAwareRoundRobinPolicy:
loadBalancingPolicy = new TokenAwarePolicy(DCAwareRoundRobinPolicy.builder().build());
loadBalancingPolicy = new TokenAwarePolicy(new DCAwareRoundRobinPolicy());
break;
case tokenLatencyAwarePolicy:
loadBalancingPolicy = new TokenAwarePolicy(LatencyAwarePolicy.builder(new RoundRobinPolicy()).build());
Expand Down

0 comments on commit d1cf653

Please sign in to comment.