me.prettyprint.cassandra.connection
Class RoundRobinBalancingPolicy

java.lang.Object
  extended by me.prettyprint.cassandra.connection.RoundRobinBalancingPolicy
All Implemented Interfaces:
Serializable, LoadBalancingPolicy

public class RoundRobinBalancingPolicy
extends Object
implements LoadBalancingPolicy

Implements a RoundRobin balancing policy based off the contents of the active HClientPool. If a pool is shutdown by another thread in the midst of the selection process, we return the pool at position 0

Author:
zznate
See Also:
Serialized Form

Constructor Summary
RoundRobinBalancingPolicy()
           
 
Method Summary
 HClientPool createConnection(HClientFactory clientFactory, CassandraHost host, CassandraClientMonitor monitor)
          Creates a connection pool for host.
 HClientPool getPool(Collection<HClientPool> pools, Set<CassandraHost> excludeHosts)
          Retrieves a pool from the collection of pools excluding excludeHosts.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

RoundRobinBalancingPolicy

public RoundRobinBalancingPolicy()
Method Detail

getPool

public HClientPool getPool(Collection<HClientPool> pools,
                           Set<CassandraHost> excludeHosts)
Description copied from interface: LoadBalancingPolicy
Retrieves a pool from the collection of pools excluding excludeHosts.

Specified by:
getPool in interface LoadBalancingPolicy
Parameters:
pools - collection of all available pools
excludeHosts - excluded pools
Returns:
a pool based on this load balancing policy

createConnection

public HClientPool createConnection(HClientFactory clientFactory,
                                    CassandraHost host,
                                    CassandraClientMonitor monitor)
Description copied from interface: LoadBalancingPolicy
Creates a connection pool for host.

Specified by:
createConnection in interface LoadBalancingPolicy
Parameters:
clientFactory - an instance of HClientFactory
host - an instance of CassandraHost representing the host this pool will represent
monitor - the monitor exposing JMX methods
Returns:
a connection pool


Copyright © 2013. All Rights Reserved.