Java Code Examples for org.apache.cassandra.utils.FBUtilities#construct()

The following examples show how to use org.apache.cassandra.utils.FBUtilities#construct() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: AbstractCassandraStorage.java    From stratio-cassandra with Apache License 2.0 5 votes vote down vote up
@Override
public InputFormat getInputFormat() throws IOException
{
    try
    {
        return FBUtilities.construct(inputFormatClass, "inputformat");
    }
    catch (ConfigurationException e)
    {
        throw new IOException(e);
    }
}
 
Example 2
Source File: AbstractCassandraStorage.java    From stratio-cassandra with Apache License 2.0 5 votes vote down vote up
/** output format */
public OutputFormat getOutputFormat() throws IOException
{
    try
    {
        return FBUtilities.construct(outputFormatClass, "outputformat");
    }
    catch (ConfigurationException e)
    {
        throw new IOException(e);
    }
}
 
Example 3
Source File: StorageService.java    From stratio-cassandra with Apache License 2.0 5 votes vote down vote up
public void updateSnitch(String epSnitchClassName, Boolean dynamic, Integer dynamicUpdateInterval, Integer dynamicResetInterval, Double dynamicBadnessThreshold) throws ClassNotFoundException
{
    IEndpointSnitch oldSnitch = DatabaseDescriptor.getEndpointSnitch();

    // new snitch registers mbean during construction
    IEndpointSnitch newSnitch;
    try
    {
        newSnitch = FBUtilities.construct(epSnitchClassName, "snitch");
    }
    catch (ConfigurationException e)
    {
        throw new ClassNotFoundException(e.getMessage());
    }
    if (dynamic)
    {
        DatabaseDescriptor.setDynamicUpdateInterval(dynamicUpdateInterval);
        DatabaseDescriptor.setDynamicResetInterval(dynamicResetInterval);
        DatabaseDescriptor.setDynamicBadnessThreshold(dynamicBadnessThreshold);
        newSnitch = new DynamicEndpointSnitch(newSnitch);
    }

    // point snitch references to the new instance
    DatabaseDescriptor.setEndpointSnitch(newSnitch);
    for (String ks : Schema.instance.getKeyspaces())
    {
        Keyspace.open(ks).getReplicationStrategy().snitch = newSnitch;
    }

    if (oldSnitch instanceof DynamicEndpointSnitch)
        ((DynamicEndpointSnitch)oldSnitch).unregisterMBean();
}
 
Example 4
Source File: DatabaseDescriptor.java    From stratio-cassandra with Apache License 2.0 5 votes vote down vote up
@VisibleForTesting
public static Config loadConfig() throws ConfigurationException
{
    String loaderClass = System.getProperty("cassandra.config.loader");
    ConfigurationLoader loader = loaderClass == null
                               ? new YamlConfigurationLoader()
                               : FBUtilities.<ConfigurationLoader>construct(loaderClass, "configuration loading");
    return loader.loadConfig();
}
 
Example 5
Source File: DatabaseDescriptor.java    From stratio-cassandra with Apache License 2.0 5 votes vote down vote up
private static IEndpointSnitch createEndpointSnitch(String snitchClassName) throws ConfigurationException
{
    if (!snitchClassName.contains("."))
        snitchClassName = "org.apache.cassandra.locator." + snitchClassName;
    IEndpointSnitch snitch = FBUtilities.construct(snitchClassName, "snitch");
    return conf.dynamic_snitch ? new DynamicEndpointSnitch(snitch) : snitch;
}