me.prettyprint.cassandra.connection
Class LeastActiveBalancingPolicy
java.lang.Object
me.prettyprint.cassandra.connection.LeastActiveBalancingPolicy
- All Implemented Interfaces:
- Serializable, LoadBalancingPolicy
public class LeastActiveBalancingPolicy
- extends Object
- implements LoadBalancingPolicy
Selects the least active host based on the number of active connections.
The list of hosts is shuffled on each pass to account for the case
where a number of hosts are at the minimum number of connections
(ie. they are not busy).
- Author:
- zznate
- See Also:
- Serialized Form
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
LeastActiveBalancingPolicy
public LeastActiveBalancingPolicy()
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 poolsexcludeHosts - excluded pools
- Returns:
- a pool based on this load balancing policy
createConnection
public HClientPool createConnection(HClientFactory clientFactory,
CassandraHost host)
- Description copied from interface:
LoadBalancingPolicy
- Creates a connection pool for
host.
- Specified by:
createConnection in interface LoadBalancingPolicy
- Parameters:
clientFactory - an instance of HClientFactoryhost - an instance of CassandraHost representing the host this pool will represent
- Returns:
- a connection pool
Copyright © 2012. All Rights Reserved.