org.apache.cassandra.locator
Class EndPointSnitch

java.lang.Object
  extended by org.apache.cassandra.locator.EndPointSnitch
All Implemented Interfaces:
IEndPointSnitch

public class EndPointSnitch
extends java.lang.Object
implements IEndPointSnitch


Constructor Summary
EndPointSnitch()
           
 
Method Summary
 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.
 boolean isInSameDataCenter(java.net.InetAddress host, java.net.InetAddress host2)
          Helps determine if 2 nodes are in the same data center.
 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.Collection<java.net.InetAddress> unsortedAddress)
          This method will sort the Set 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

EndPointSnitch

public EndPointSnitch()
Method Detail

isOnSameRack

public boolean isOnSameRack(java.net.InetAddress host,
                            java.net.InetAddress host2)
                     throws java.net.UnknownHostException
Description copied from interface: IEndPointSnitch
Helps determine if 2 nodes are in the same rack in the data center.

Specified by:
isOnSameRack in interface IEndPointSnitch
Parameters:
host - a specified endpoint
host2 - another specified endpoint
Returns:
true if on the same rack false otherwise
Throws:
java.net.UnknownHostException

isInSameDataCenter

public boolean isInSameDataCenter(java.net.InetAddress host,
                                  java.net.InetAddress host2)
                           throws java.net.UnknownHostException
Description copied from interface: IEndPointSnitch
Helps determine if 2 nodes are in the same data center.

Specified by:
isInSameDataCenter in interface IEndPointSnitch
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 java.lang.String getLocation(java.net.InetAddress endpoint)
                             throws java.net.UnknownHostException
Description copied from interface: IEndPointSnitch
Given endpoints this method will help us know the datacenter name where the node is located at.

Specified by:
getLocation in interface IEndPointSnitch
Throws:
java.net.UnknownHostException

sortByProximity

public java.util.List<java.net.InetAddress> sortByProximity(java.net.InetAddress address,
                                                            java.util.Collection<java.net.InetAddress> unsortedAddress)
Description copied from interface: IEndPointSnitch
This method will sort the Set according to the proximity of the given address.

Specified by:
sortByProximity in interface IEndPointSnitch


Copyright © 2009 The Apache Software Foundation