## org.apache.cassandra.locator
Interface IEndPointSnitch

All Known Implementing Classes:
  AbstractEndpointSnitch, DynamicEndpointSnitch, EndPointSnitch

    public interface IEndPointSnitch

This interface helps determine location of node in the data center relative to another node. Give a node A and another node B it can tell if A and B are on the same rack or in the same data center. Not all methods will be germate to all implementations. Throw UnsupportedOperation as necessary.

Method Summary
`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.lang.String` `getLocation(java.net.InetAddress endpoint)`
`java.util.List<java.net.InetAddress>` `getSortedListByProximity(java.net.InetAddress address, java.util.Collection<java.net.InetAddress> unsortedAddress)` returns a new List<InetAddress> sorted by proximity to the given endpoint
`boolean` `isInSameDataCenter(java.net.InetAddress a1, java.net.InetAddress a2)` indicates whether two endpoints are in the same datacenter
`boolean` `isOnSameRack(java.net.InetAddress a1, java.net.InetAddress a2)` indicates whether two endpoints are on the same rack
`java.util.List<java.net.InetAddress>` `sortByProximity(java.net.InetAddress address, java.util.List<java.net.InetAddress> addresses)` This method will sort the List<InetAddress> according to the proximity of the given address.

Method Detail

### getSortedListByProximity

    java.util.List<java.net.InetAddress> getSortedListByProximity(java.net.InetAddress address,
                                                                  java.util.Collection<java.net.InetAddress> unsortedAddress)

  returns a new List<InetAddress> sorted by proximity to the given endpoint

### sortByProximity

    java.util.List<java.net.InetAddress> sortByProximity(java.net.InetAddress address,
                                                         java.util.List<java.net.InetAddress> addresses)

  This method will sort the List<InetAddress> according to the proximity of the given address.

### compareEndpoints

    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

### isOnSameRack

    boolean isOnSameRack(java.net.InetAddress a1,
                         java.net.InetAddress a2)
                         throws java.net.UnknownHostException

  indicates whether two endpoints are on the same rack

  Throws:
    `java.net.UnknownHostException`

### isInSameDataCenter

    boolean isInSameDataCenter(java.net.InetAddress a1,
                               java.net.InetAddress a2)
                               throws java.net.UnknownHostException

  indicates whether two endpoints are in the same datacenter

  Throws:
    `java.net.UnknownHostException`

### getLocation

    java.lang.String getLocation(java.net.InetAddress endpoint)
                                 throws java.net.UnknownHostException

  Throws:
    `java.net.UnknownHostException`

Copyright © 2010 The Apache Software Foundation