org.apache.cassandra.locator
Class AbstractEndpointSnitch

java.lang.Object
  extended by org.apache.cassandra.locator.AbstractEndpointSnitch
All Implemented Interfaces:
IEndpointSnitch
Direct Known Subclasses:
AbstractNetworkTopologySnitch, DynamicEndpointSnitch, SimpleSnitch

public abstract class AbstractEndpointSnitch
extends java.lang.Object
implements IEndpointSnitch


Field Summary
protected  java.util.List<AbstractReplicationStrategy> subscribers
           
 
Constructor Summary
AbstractEndpointSnitch()
           
 
Method Summary
 void cacheEndpoint(Token t, java.util.ArrayList<java.net.InetAddress> addr)
          puts an address in the cache for a given token.
 void clearEndpointCache()
          clears all cache values.
 int compareEndpoints(java.net.InetAddress target, java.net.InetAddress a1, java.net.InetAddress a2)
          compares two endpoints in relation to the target endpoint, returning as Comparator.compare would
 java.util.ArrayList<java.net.InetAddress> getCachedEndpoints(Token t)
          returns a list of cached endpoints for a given token.
abstract  java.util.List<java.net.InetAddress> getSortedListByProximity(java.net.InetAddress address, java.util.Collection<java.net.InetAddress> unsortedAddress)
          returns a new List sorted by proximity to the given endpoint
abstract  java.util.List<java.net.InetAddress> sortByProximity(java.net.InetAddress address, java.util.List<java.net.InetAddress> addresses)
          This method will sort the List by proximity to the given address.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.apache.cassandra.locator.IEndpointSnitch
getDatacenter, getRack
 

Field Detail

subscribers

protected java.util.List<AbstractReplicationStrategy> subscribers
Constructor Detail

AbstractEndpointSnitch

public AbstractEndpointSnitch()
Method Detail

getCachedEndpoints

public java.util.ArrayList<java.net.InetAddress> getCachedEndpoints(Token t)
Description copied from interface: IEndpointSnitch
returns a list of cached endpoints for a given token.

Specified by:
getCachedEndpoints in interface IEndpointSnitch

cacheEndpoint

public void cacheEndpoint(Token t,
                          java.util.ArrayList<java.net.InetAddress> addr)
Description copied from interface: IEndpointSnitch
puts an address in the cache for a given token.

Specified by:
cacheEndpoint in interface IEndpointSnitch

clearEndpointCache

public void clearEndpointCache()
Description copied from interface: IEndpointSnitch
clears all cache values.

Specified by:
clearEndpointCache in interface IEndpointSnitch

getSortedListByProximity

public abstract java.util.List<java.net.InetAddress> getSortedListByProximity(java.net.InetAddress address,
                                                                              java.util.Collection<java.net.InetAddress> unsortedAddress)
Description copied from interface: IEndpointSnitch
returns a new List sorted by proximity to the given endpoint

Specified by:
getSortedListByProximity in interface IEndpointSnitch

sortByProximity

public abstract java.util.List<java.net.InetAddress> sortByProximity(java.net.InetAddress address,
                                                                     java.util.List<java.net.InetAddress> addresses)
Description copied from interface: IEndpointSnitch
This method will sort the List by proximity to the given address.

Specified by:
sortByProximity in interface IEndpointSnitch

compareEndpoints

public int compareEndpoints(java.net.InetAddress target,
                            java.net.InetAddress a1,
                            java.net.InetAddress a2)
Description copied from interface: IEndpointSnitch
compares two endpoints in relation to the target endpoint, returning as Comparator.compare would

Specified by:
compareEndpoints in interface IEndpointSnitch


Copyright © 2010 The Apache Software Foundation