TokenAwarePolicy ClassA C# client driver for Apache Cassandra
A wrapper load balancing policy that add token awareness to a child policy.

This policy encapsulates another policy. The resulting policy works in the following way:

  • the method is inherited from the child policy.
  • the iterator return by the
    newQueryPlan
    method will first return the replicas for the query (based on Query#getRoutingKey) if possible (i.e. if the query
    getRoutingKey
    method doesn't return {@code null} and if {@link Metadata#getReplicas}' returns a non empty set of replicas for that partition key). If no local replica can be either found or successfully contacted, the rest of the query plan will fallback to one of the child policy.

Do note that only replica for which the child policy

method returns
HostDistance.Local
will be considered having priority. For example, if you wrap DCAwareRoundRobinPolicy with this token aware policy, replicas from remote data centers may only be returned after all the host of the local data center.

Inheritance Hierarchy

OnlineSystem Object
  Cassandra TokenAwarePolicy

Namespace: Cassandra
Assembly: Cassandra (in Cassandra.dll) Version: 1.0.0.0 (1.0.0.0)
Syntax

public class TokenAwarePolicy : ILoadBalancingPolicy
See Also