Example usage for org.apache.cassandra.config DatabaseDescriptor loadConfig

List of usage examples for org.apache.cassandra.config DatabaseDescriptor loadConfig

Introduction

In this page you can find the example usage for org.apache.cassandra.config DatabaseDescriptor loadConfig.

Prototype

@VisibleForTesting
    public static Config loadConfig() throws ConfigurationException 

Source Link

Usage

From source file:org.hawkular.openshift.cassandra.OpenshiftSeedProvider.java

License:Apache License

private List<InetAddress> getSeedsFromConfig() throws ConfigurationException {
    List<InetAddress> seedsAddresses = new ArrayList<>();

    Config config = DatabaseDescriptor.loadConfig();
    String seeds = config.seed_provider.parameters.get(PARAMETER_SEEDS);

    for (String seed : seeds.split(",")) {
        try {//from  ww w  .j  a  v a 2  s  .  co m
            InetAddress inetAddress = InetAddress.getByName(seed);
            logger.debug("Adding seed '" + inetAddress.getHostAddress() + "' from the configuration file.");
            seedsAddresses.add(inetAddress);
        } catch (UnknownHostException e) {
            logger.warn("Could not get address for seed entry '" + seed + "'", e);
        }
    }

    return seedsAddresses;
}