Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.apache.cassandra.locator
Class EndPointSnitch

    java.lang.Object
      org.apache.cassandra.locator.AbstractEndpointSnitch
          org.apache.cassandra.locator.EndPointSnitch

All Implemented Interfaces:
  IEndPointSnitch

    public class EndPointSnitch

extends AbstractEndpointSnitch

A simple endpoint snitch implementation that assumes rack and dc information is encoded in the ip address.

Constructor Summary
`EndPointSnitch()`

Method Summary
`java.lang.String` | `getLocation(java.net.InetAddress endpoint)` Determines the name of the datacenter this endpoint lives in.
`boolean` | `isInSameDataCenter(java.net.InetAddress host, java.net.InetAddress host2)` Determines if 2 nodes are in the same data center.
`boolean` | `isOnSameRack(java.net.InetAddress host, java.net.InetAddress host2)` Determines if 2 nodes are in the same rack in the data center.

Methods inherited from class org.apache.cassandra.locator.AbstractEndpointSnitch
`compareEndpoints, getSortedListByProximity, sortByProximity`

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 class: `AbstractEndpointSnitch`
  Determines if 2 nodes are in the same rack in the data center.

  Specified by:
    `isOnSameRack` in interface `IEndPointSnitch`
  Specified by:
    `isOnSameRack` in class `AbstractEndpointSnitch`
  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 class: `AbstractEndpointSnitch`
  Determines if 2 nodes are in the same data center.

  Specified by:
    `isInSameDataCenter` in interface `IEndPointSnitch`
  Specified by:
    `isInSameDataCenter` in class `AbstractEndpointSnitch`
  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 class: `AbstractEndpointSnitch`
  Determines the name of the datacenter this endpoint lives in.

  Specified by:
    `getLocation` in interface `IEndPointSnitch`
  Specified by:
    `getLocation` in class `AbstractEndpointSnitch`
  Returns:
    the name of the datacenter the endpoint lives in
  Throws:
    `java.net.UnknownHostException`

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright © 2010 The Apache Software Foundation