Example usage for org.apache.cassandra.utils FBUtilities resourceToFile

List of usage examples for org.apache.cassandra.utils FBUtilities resourceToFile

Introduction

In this page you can find the example usage for org.apache.cassandra.utils FBUtilities resourceToFile.

Prototype

public static String resourceToFile(String filename) throws ConfigurationException 

Source Link

Usage

From source file:brooklyn.entity.nosql.cassandra.customsnitch.MultiCloudSnitch.java

License:Apache License

public MultiCloudSnitch() throws ConfigurationException {
    reloadConfiguration();/*from  ww  w  .  j  a  v a2s .com*/
    logger.info("CustomSnitch using datacenter: " + datacenter + ", rack: " + rack + ", publicip: " + public_ip
            + ", privateip: " + private_ip);

    try {
        FBUtilities.resourceToFile(SNITCH_PROPERTIES_FILENAME);
        Runnable runnable = new WrappedRunnable() {
            protected void runMayThrow() throws ConfigurationException {
                reloadConfiguration();
            }
        };
        ResourceWatcher.watch(SNITCH_PROPERTIES_FILENAME, runnable, 60 * 1000);
    } catch (ConfigurationException ex) {
        logger.debug(SNITCH_PROPERTIES_FILENAME
                + " found, but does not look like a plain file. Will not watch it for changes");
    }
}