DynamicEndpointSnitch (apache-cassandra API)
Date: 2018-02-12

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

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `IEndpointSnitch` | `subsnitch`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `DynamicEndpointSnitch(IEndpointSnitch snitch)`
    `DynamicEndpointSnitch(IEndpointSnitch snitch, java.lang.String instance)`

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `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.util.List<java.lang.Double>` | `dumpTimings(java.lang.String hostname)`
    `double` | `getBadnessThreshold()`
    `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
    `int` | `getResetInterval()`
    `java.util.Map<java.net.InetAddress,java.lang.Double>` | `getScores()`
    `double` | `getSeverity()`
    `java.util.List<java.net.InetAddress>` | `getSortedListByProximity(java.net.InetAddress address, java.util.Collection<java.net.InetAddress> addresses)` Sorts the `Collection` of node addresses by proximity to the given address
    `java.lang.String` | `getSubsnitchClassName()`
    `int` | `getUpdateInterval()`
    `void` | `gossiperStarting()` called after Gossiper instance exists immediately before it starts gossiping
    `boolean` | `isWorthMergingForRangeQuery(java.util.List<java.net.InetAddress> merged, java.util.List<java.net.InetAddress> l1, java.util.List<java.net.InetAddress> l2)` Returns whether for a range query doing a query against merged is likely to be faster than 2 sequential queries, one against l1 followed by one against l2.
    `void` | `receiveTiming(java.net.InetAddress host, long latency)`
    `void` | `setSeverity(double severity)` Use this if you want to specify a severity; it can be negative Example: Page cache is cold and you want data to be sent though it is not preferred one.
    `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
    `void` | `unregisterMBean()`

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

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

- - ### Field Detail

    - #### subsnitch

          public final IEndpointSnitch subsnitch

  - ### Constructor Detail

    - #### DynamicEndpointSnitch

          public DynamicEndpointSnitch(IEndpointSnitch snitch)

    - #### DynamicEndpointSnitch

          public DynamicEndpointSnitch(IEndpointSnitch snitch,
                                       java.lang.String instance)

  - ### Method Detail

    - #### unregisterMBean

          public void unregisterMBean()

    - #### gossiperStarting

          public void gossiperStarting()

      Description copied from interface: `IEndpointSnitch`
      called after Gossiper instance exists immediately before it starts gossiping
      Specified by:
        `gossiperStarting` in interface `IEndpointSnitch`
      Overrides:
        `gossiperStarting` in class `AbstractEndpointSnitch`

    - #### 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
      Specified by:
        `getRack` in interface `IEndpointSnitch`

    - #### 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
      Specified by:
        `getDatacenter` in interface `IEndpointSnitch`

    - #### getSortedListByProximity

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

      Description copied from class: `AbstractEndpointSnitch`
      Sorts the `Collection` of node addresses by proximity to the given address
      Specified by:
        `getSortedListByProximity` in interface `IEndpointSnitch`
      Overrides:
        `getSortedListByProximity` in class `AbstractEndpointSnitch`
      Parameters:
        `address` - the address to sort by proximity to
        `addresses` - the nodes to sort
      Returns:
        a new sorted `List`

    - #### 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`

    - #### receiveTiming

          public void receiveTiming(java.net.InetAddress host,
                                    long 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`

    - #### getUpdateInterval

          public int getUpdateInterval()

      Specified by:
        `getUpdateInterval` in interface `DynamicEndpointSnitchMBean`

    - #### getResetInterval

          public int getResetInterval()

      Specified by:
        `getResetInterval` in interface `DynamicEndpointSnitchMBean`

    - #### getBadnessThreshold

          public double getBadnessThreshold()

      Specified by:
        `getBadnessThreshold` in interface `DynamicEndpointSnitchMBean`

    - #### getSubsnitchClassName

          public java.lang.String getSubsnitchClassName()

      Specified by:
        `getSubsnitchClassName` in interface `DynamicEndpointSnitchMBean`

    - #### dumpTimings

          public java.util.List<java.lang.Double> dumpTimings(java.lang.String hostname)
                                                       throws java.net.UnknownHostException

      Specified by:
        `dumpTimings` in interface `DynamicEndpointSnitchMBean`
      Throws:
        `java.net.UnknownHostException`

    - #### setSeverity

          public void setSeverity(double severity)

      Description copied from interface: `DynamicEndpointSnitchMBean`
      Use this if you want to specify a severity; it can be negative Example: Page cache is cold and you want data to be sent though it is not preferred one.
      Specified by:
        `setSeverity` in interface `DynamicEndpointSnitchMBean`

    - #### getSeverity

          public double getSeverity()

      Specified by:
        `getSeverity` in interface `DynamicEndpointSnitchMBean`

    - #### isWorthMergingForRangeQuery

          public boolean isWorthMergingForRangeQuery(java.util.List<java.net.InetAddress> merged,
                                                     java.util.List<java.net.InetAddress> l1,
                                                     java.util.List<java.net.InetAddress> l2)

      Description copied from interface: `IEndpointSnitch`
      Returns whether for a range query doing a query against merged is likely to be faster than 2 sequential queries, one against l1 followed by one against l2.
      Specified by:
        `isWorthMergingForRangeQuery` in interface `IEndpointSnitch`
      Overrides:
        `isWorthMergingForRangeQuery` in class `AbstractEndpointSnitch`

Copyright © 2018 The Apache Software Foundation