public class RoundRobinPolicy extends Object implements LoadBalancingPolicy
DCAwareRoundRobinPolicy load balancing policy instead.| Constructor and Description |
|---|
RoundRobinPolicy()
Creates a load balancing policy that picks host to query in a round robin
fashion (on all the hosts of the Cassandra cluster).
|
| Modifier and Type | Method and Description |
|---|---|
void |
close()
Gets invoked at cluster shutdown.
|
HostDistance |
distance(Host host)
Return the HostDistance for the provided host.
|
void |
init(Cluster cluster,
Collection<Host> hosts)
Initialize this load balancing policy.
|
Iterator<Host> |
newQueryPlan(String loggedKeyspace,
Statement statement)
Returns the hosts to use for a new query.
|
void |
onAdd(Host host)
Called when a new node is added to the cluster.
|
void |
onDown(Host host)
Called when a node is determined to be down.
|
void |
onRemove(Host host)
Called when a node is removed from the cluster.
|
void |
onUp(Host host)
Called when a node is determined to be up.
|
public RoundRobinPolicy()
public void init(Cluster cluster, Collection<Host> hosts)
LoadBalancingPolicyinit in interface LoadBalancingPolicycluster - the Cluster instance for which the policy is created.hosts - the initial hosts to use.public HostDistance distance(Host host)
DCAwareRoundRobinPolicy instead.distance in interface LoadBalancingPolicyhost - the host of which to return the distance of.host.public Iterator<Host> newQueryPlan(String loggedKeyspace, Statement statement)
ith host of the plans returned will cycle
over all the hosts of the cluster in a round-robin fashion.newQueryPlan in interface LoadBalancingPolicyloggedKeyspace - the keyspace currently logged in on for this
query.statement - the query for which to build the plan.public void onUp(Host host)
LoadBalancingPolicyonUp in interface LoadBalancingPolicyhost - the host that has been detected up.public void onDown(Host host)
LoadBalancingPolicyonDown in interface LoadBalancingPolicyhost - the host that has been detected down.public void onAdd(Host host)
LoadBalancingPolicyonAdd in interface LoadBalancingPolicyhost - the host that has been newly added.public void onRemove(Host host)
LoadBalancingPolicyonRemove in interface LoadBalancingPolicyhost - the removed host.public void close()
LoadBalancingPolicyclose in interface LoadBalancingPolicyCopyright © 2012–2017. All rights reserved.