com.github.adejanovski.cassandra.jdbc.policies.DCAwareRoundRobinPolicy Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of cassandra-jdbc-wrapper Show documentation
Show all versions of cassandra-jdbc-wrapper Show documentation
JDBC wrapper for the DataStax CQL Java Driver.
package com.github.adejanovski.cassandra.jdbc.policies;
import com.datastax.driver.core.policies.DCAwareRoundRobinPolicy.*;
public class DCAwareRoundRobinPolicy {
Builder builder = com.datastax.driver.core.policies.DCAwareRoundRobinPolicy.builder();
public DCAwareRoundRobinPolicy(String localDc) {
builder.withLocalDc(localDc);
}
public DCAwareRoundRobinPolicy(String localDc, int usedHostsPerRemoteDc) {
builder.withLocalDc(localDc)
.withUsedHostsPerRemoteDc(usedHostsPerRemoteDc);
}
public DCAwareRoundRobinPolicy(String localDc, int usedHostsPerRemoteDc, boolean allowRemoteDCsForLocalConsistencyLevel) {
builder.withLocalDc(localDc)
.withUsedHostsPerRemoteDc(usedHostsPerRemoteDc);
if(allowRemoteDCsForLocalConsistencyLevel){
builder.allowRemoteDCsForLocalConsistencyLevel();
}
}
public com.datastax.driver.core.policies.DCAwareRoundRobinPolicy build(){
return builder.build();
}
}