org.apache.cassandra.locator
Class PropertyFileSnitch

java.lang.Object
  extended by org.apache.cassandra.locator.AbstractEndpointSnitch
      extended by org.apache.cassandra.locator.AbstractNetworkTopologySnitch
          extended by 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


Constructor Summary
PropertyFileSnitch()
           
 
Method Summary
 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 reloadConfiguration()
           
 
Methods inherited from class org.apache.cassandra.locator.AbstractNetworkTopologySnitch
compareEndpoints, getSortedListByProximity, sortByProximity
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

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


Copyright © 2011 The Apache Software Foundation