All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.github.adejanovski.cassandra.jdbc.policies.DCAwareRoundRobinPolicy Maven / Gradle / Ivy

There is a newer version: 3.1.0
Show newest version
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();
	}

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy