in sandbox/cassandra-multicloud-snitch/src/main/java/org/apache/brooklyn/entity/nosql/cassandra/customsnitch/MultiCloudSnitch.java [100:143]
public void reloadConfiguration() throws ConfigurationException
{
HashMap<InetAddress, String[]> reloadedMap = new HashMap<InetAddress, String[]>();
String DC_PROPERTY = "dc";
String RACK_PROPERTY = "rack";
String PUBLIC_IP_PROPERTY = "publicip";
String PRIVATE_IP_PROPERTY = "privateip";
Properties properties = new Properties();
InputStream stream = null;
try
{
stream = getClass().getClassLoader().getResourceAsStream(SNITCH_PROPERTIES_FILENAME);
properties.load(stream);
}
catch (Exception e)
{
throw new ConfigurationException("Unable to read " + SNITCH_PROPERTIES_FILENAME, e);
}
finally
{
FileUtils.closeQuietly(stream);
}
datacenter = properties.getProperty(DC_PROPERTY);
rack = properties.getProperty(RACK_PROPERTY);
private_ip = checkNotNull(properties.getProperty(PRIVATE_IP_PROPERTY), "%s in %s", PRIVATE_IP_PROPERTY, SNITCH_PROPERTIES_FILENAME);
String public_ip_str = checkNotNull(properties.getProperty(PUBLIC_IP_PROPERTY), "%s in %s", PUBLIC_IP_PROPERTY, SNITCH_PROPERTIES_FILENAME);
try {
public_ip = InetAddress.getByName(public_ip_str);
}
catch (UnknownHostException e)
{
throw new ConfigurationException("Unknown host " + public_ip_str, e);
}
logger.debug("CustomSnitch reloaded, using datacenter: " + datacenter + ", rack: " + rack + ", publicip: " + public_ip + ", privateip: " + private_ip);
if (StorageService.instance != null) // null check tolerates circular dependency; see CASSANDRA-4145
StorageService.instance.getTokenMetadata().invalidateCaches();
if (gossipStarted)
StorageService.instance.gossipSnitchInfo();
}