org.apache.cassandra.locator

## Class PropertyFileSnitch

- java.lang.Object
- - org.apache.cassandra.locator.AbstractEndpointSnitch
  - - org.apache.cassandra.locator.AbstractNetworkTopologySnitch
    - - org.apache.cassandra.locator.PropertyFileSnitch

- All Implemented Interfaces:
    IEndpointSnitch

      public class PropertyFileSnitch
      extends AbstractNetworkTopologySnitch

  Used to determine if two IP's are in the same datacenter or on the same rack.

  Based on a properties file in the following format: 10.0.0.13=DC1:RAC2 10.21.119.14=DC3:RAC2 10.20.114.15=DC2:RAC2 default=DC1:r1

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `static java.lang.String` | `SNITCH_PROPERTIES_FILENAME`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `PropertyFileSnitch()`
    `PropertyFileSnitch(int refreshPeriodInSeconds)`

  - ### Method Summary

    All Methods Static Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `java.lang.String` | `getDatacenter(java.net.InetAddress endpoint)` Return the data center for which an endpoint resides in
    `static java.lang.String[]` | `getEndpointInfo(java.net.InetAddress endpoint)` Get the raw information about an end point
    `java.lang.String` | `getRack(java.net.InetAddress endpoint)` Return the rack for which an endpoint resides in
    `void` | `gossiperStarting()` called after Gossiper instance exists immediately before it starts gossiping
    `void` | `reloadConfiguration(boolean isUpdate)`

    - ### Methods inherited from class org.apache.cassandra.locator.AbstractNetworkTopologySnitch

      `compareEndpoints`

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

      `getSortedListByProximity, isWorthMergingForRangeQuery, sortByProximity`

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

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

- - ### Field Detail

    - #### SNITCH_PROPERTIES_FILENAME

          public static final java.lang.String SNITCH_PROPERTIES_FILENAME

      See Also:
        Constant Field Values

  - ### Constructor Detail

    - #### PropertyFileSnitch

          public PropertyFileSnitch()
                             throws ConfigurationException

      Throws:
        `ConfigurationException`

    - #### PropertyFileSnitch

          public PropertyFileSnitch(int refreshPeriodInSeconds)
                             throws ConfigurationException

      Throws:
        `ConfigurationException`

  - ### Method Detail

    - #### getEndpointInfo

          public static java.lang.String[] getEndpointInfo(java.net.InetAddress endpoint)

      Get the raw information about an end point
      Parameters:
        `endpoint` - endpoint to process
      Returns:
        a array of string with the first index being the data center and the second being the rack

    - #### getDatacenter

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

      Return the data center for which an endpoint resides in
      Specified by:
        `getDatacenter` in interface `IEndpointSnitch`
      Specified by:
        `getDatacenter` in class `AbstractNetworkTopologySnitch`
      Parameters:
        `endpoint` - the endpoint to process
      Returns:
        string of data center

    - #### getRack

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

      Return the rack for which an endpoint resides in
      Specified by:
        `getRack` in interface `IEndpointSnitch`
      Specified by:
        `getRack` in class `AbstractNetworkTopologySnitch`
      Parameters:
        `endpoint` - the endpoint to process
      Returns:
        string of rack

    - #### reloadConfiguration

          public void reloadConfiguration(boolean isUpdate)
                                   throws ConfigurationException

      Throws:
        `ConfigurationException`

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

Copyright © 2018 The Apache Software Foundation