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 DynamicEndpointSnitch

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

All Implemented Interfaces:
  DynamicEndpointSnitchMBean, IEndPointSnitch, ILatencySubscriber

    public class DynamicEndpointSnitch

extends AbstractEndpointSnitch
implements ILatencySubscriber, DynamicEndpointSnitchMBean

A dynamic snitch that sorts endpoints by latency with an adapted phi failure detector

Field Summary
`IEndPointSnitch` | `subsnitch`

Constructor Summary
`DynamicEndpointSnitch(IEndPointSnitch snitch)`

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)` Determines the name of the datacenter this endpoint lives in.
`java.util.Map<java.net.InetAddress,java.lang.Double>` | `getScores()`
`java.util.List<java.net.InetAddress>` | `getSortedListByProximity(java.net.InetAddress address, java.util.Collection<java.net.InetAddress> addresses)` returns a new List sorted by proximity to the given endpoint
`boolean` | `isInSameDataCenter(java.net.InetAddress a1, java.net.InetAddress a2)` Determines if 2 nodes are in the same data center.
`boolean` | `isOnSameRack(java.net.InetAddress a1, java.net.InetAddress a2)` Determines if 2 nodes are in the same rack in the data center.
`void` | `receiveTiming(java.net.InetAddress host, java.lang.Double latency)`
`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`

Field Detail

### subsnitch

    public IEndPointSnitch subsnitch

Constructor Detail

### DynamicEndpointSnitch

    public DynamicEndpointSnitch(IEndPointSnitch snitch)

Method Detail

### isOnSameRack

    public boolean isOnSameRack(java.net.InetAddress a1,
                                java.net.InetAddress a2)
                         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:
    `a1` - a specified endpoint
    `a2` - another specified endpoint
  Returns:
    true if on the same rack false otherwise
  Throws:
    `java.net.UnknownHostException`

### isInSameDataCenter

    public boolean isInSameDataCenter(java.net.InetAddress a1,
                                      java.net.InetAddress a2)
                               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:
    `a1` - a specified endpoint
    `a2` - 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`

### getSortedListByProximity

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

  Description copied from interface: `IEndPointSnitch`
  returns a new List sorted by proximity to the given endpoint

  Specified by:
    `getSortedListByProximity` in interface `IEndPointSnitch`
  Overrides:
    `getSortedListByProximity` in class `AbstractEndpointSnitch`

### 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`
  Overrides:
    `sortByProximity` in class `AbstractEndpointSnitch`

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

### receiveTiming

    public void receiveTiming(java.net.InetAddress host,
                              java.lang.Double latency)

  Specified by:
    `receiveTiming` in interface `ILatencySubscriber`

### getScores

    public java.util.Map<java.net.InetAddress,java.lang.Double> getScores()

  Specified by:
    `getScores` in interface `DynamicEndpointSnitchMBean`

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