PropertyFileSnitch (apache-cassandra API)
Date: 2014-10-21

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()`

  - ### Method Summary

    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
    `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()`

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

  - ### Method Detail

    - #### getEndpointInfo

          public 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()
                                   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 © 2014 The Apache Software Foundation