org.apache.cassandra.locator

## Class SimpleSnitch

- java.lang.Object
- - org.apache.cassandra.locator.AbstractEndpointSnitch
  - - org.apache.cassandra.locator.SimpleSnitch

All Implemented Interfaces:
  IEndpointSnitch

    public class SimpleSnitch
    extends AbstractEndpointSnitch

A simple endpoint snitch implementation that treats Strategy order as proximity, allowing non-read-repaired reads to prefer a single endpoint, which improves cache locality.

### Constructor Summary

Constructors
Constructor and Description
`SimpleSnitch()`

### Method Summary

All Methods Instance Methods Concrete Methods
`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` `getDatacenter(java.net.InetAddress endpoint)` returns a String representing the datacenter this endpoint belongs to
`java.lang.String` `getRack(java.net.InetAddress endpoint)` returns a String repesenting the rack this endpoint belongs to
`void` `sortByProximity(java.net.InetAddress address, java.util.List<java.net.InetAddress> addresses)` Sorts the `List` of node addresses, in-place, by proximity to the given address

### Methods inherited from class org.apache.cassandra.locator.AbstractEndpointSnitch

`getSortedListByProximity, gossiperStarting, isWorthMergingForRangeQuery`

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

### Constructor Detail

#### SimpleSnitch

    public SimpleSnitch()

### Method Detail

#### getRack

    public java.lang.String getRack(java.net.InetAddress endpoint)

Description copied from interface: `IEndpointSnitch`
returns a String repesenting the rack this endpoint belongs to

#### getDatacenter

    public java.lang.String getDatacenter(java.net.InetAddress endpoint)

Description copied from interface: `IEndpointSnitch`
returns a String representing the datacenter this endpoint belongs to

#### sortByProximity

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

Description copied from class: `AbstractEndpointSnitch`
Sorts the `List` of node addresses, in-place, by proximity to the given address

Specified by:
  `sortByProximity` in interface `IEndpointSnitch`
Overrides:
  `sortByProximity` in class `AbstractEndpointSnitch`
Parameters:
  `address` - the address to sort the proximity by
  `addresses` - the nodes to sort

#### 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`
Specified by:
  `compareEndpoints` in class `AbstractEndpointSnitch`