Example usage for org.apache.cassandra.utils WrappedRunnable WrappedRunnable

List of usage examples for org.apache.cassandra.utils WrappedRunnable WrappedRunnable

Introduction

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

Prototype

WrappedRunnable

Source Link

Usage

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

License:Apache License

public MultiCloudSnitch() throws ConfigurationException {
    reloadConfiguration();// w  w w .  jav a  2s .  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");
    }
}