org.apache.cassandra.locator
Class AbstractEndpointSnitch

java.lang.Object
  extended by org.apache.cassandra.locator.AbstractEndpointSnitch
All Implemented Interfaces:
IEndPointSnitch
Direct Known Subclasses:
DatacenterEndPointSnitch, EndPointSnitch

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


Constructor Summary
AbstractEndpointSnitch()
           
 
Method Summary
abstract  java.lang.String getLocation(java.net.InetAddress endpoint)
          Given endpoints this method will help us know the datacenter name where the node is located at.
 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  boolean isInSameDataCenter(java.net.InetAddress host, java.net.InetAddress host2)
          Helps determine if 2 nodes are in the same data center.
abstract  boolean isOnSameRack(java.net.InetAddress host, java.net.InetAddress host2)
          Helps determine if 2 nodes are in the same rack in the data center.
 java.util.List<java.net.InetAddress> sortByProximity(java.net.InetAddress address, java.util.List<java.net.InetAddress> addresses)
          This method will sort the List according to the proximity of the given address.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AbstractEndpointSnitch

public AbstractEndpointSnitch()
Method Detail

isOnSameRack

public abstract boolean isOnSameRack(java.net.InetAddress host,
                                     java.net.InetAddress host2)
                              throws java.net.UnknownHostException
Helps determine if 2 nodes are in the same rack in the data center.

Parameters:
host - a specified endpoint
host2 - another specified endpoint
Returns:
true if on the same rack false otherwise
Throws:
java.net.UnknownHostException

isInSameDataCenter

public abstract boolean isInSameDataCenter(java.net.InetAddress host,
                                           java.net.InetAddress host2)
                                    throws java.net.UnknownHostException
Helps determine if 2 nodes are in the same data center.

Parameters:
host - a specified endpoint
host2 - another specified endpoint
Returns:
true if in the same data center false otherwise
Throws:
java.net.UnknownHostException

getLocation

public abstract java.lang.String getLocation(java.net.InetAddress endpoint)
                                      throws java.net.UnknownHostException
Given endpoints this method will help us know the datacenter name where the node is located at.

Throws:
java.net.UnknownHostException

getSortedListByProximity

public 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 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 according to the proximity of the given address.

Specified by:
sortByProximity in interface IEndPointSnitch


Copyright © 2010 The Apache Software Foundation