Search in sources :

Example 1 with ConfigurationMap

use of org.apache.commons.configuration.ConfigurationMap in project pinot by linkedin.

the class SegmentFetcherFactory method initSegmentFetcherFactory.

public static void initSegmentFetcherFactory(Configuration pinotHelixProperties) {
    Configuration segmentFetcherFactoryConfig = pinotHelixProperties.subset(CommonConstants.Server.PREFIX_OF_CONFIG_OF_SEGMENT_FETCHER_FACTORY);
    Iterator segmentFetcherFactoryConfigIterator = segmentFetcherFactoryConfig.getKeys();
    while (segmentFetcherFactoryConfigIterator.hasNext()) {
        Object configKeyObject = segmentFetcherFactoryConfigIterator.next();
        try {
            String segmentFetcherConfigKey = configKeyObject.toString();
            String protocol = segmentFetcherConfigKey.split(".", 2)[0];
            if (!SegmentFetcherFactory.containsProtocol(protocol)) {
                SegmentFetcherFactory.initSegmentFetcher(new ConfigurationMap(segmentFetcherFactoryConfig.subset(protocol)));
            }
        } catch (Exception e) {
            LOGGER.error("Got exception to process the key: " + configKeyObject);
        }
    }
}
Also used : Configuration(org.apache.commons.configuration.Configuration) Iterator(java.util.Iterator) ConfigurationMap(org.apache.commons.configuration.ConfigurationMap)

Example 2 with ConfigurationMap

use of org.apache.commons.configuration.ConfigurationMap in project pinot by linkedin.

the class PercentageBasedRoutingTableSelector method init.

public void init(Configuration configuration, ZkHelixPropertyStore<ZNRecord> propertyStore) {
    try {
        Configuration tablesConfig = configuration.subset(TABLE_KEY);
        if (tablesConfig == null || tablesConfig.isEmpty()) {
            LOGGER.info("No specific table configuration. Using 0% LLC for all tables");
            return;
        }
        ConfigurationMap cmap = new ConfigurationMap(tablesConfig);
        Set<Map.Entry<String, Integer>> mapEntrySet = cmap.entrySet();
        for (Map.Entry<String, Integer> entry : mapEntrySet) {
            LOGGER.info("Using {} percent LLC routing for table {}", entry.getValue(), entry.getKey());
            _percentMap.put(entry.getKey(), entry.getValue());
        }
    } catch (Exception e) {
        LOGGER.warn("Could not parse get config for {}. Using no LLC routing", TABLE_KEY, e);
    }
}
Also used : Configuration(org.apache.commons.configuration.Configuration) ConfigurationMap(org.apache.commons.configuration.ConfigurationMap) Map(java.util.Map) HashMap(java.util.HashMap) ConfigurationMap(org.apache.commons.configuration.ConfigurationMap)

Aggregations

Configuration (org.apache.commons.configuration.Configuration)2 ConfigurationMap (org.apache.commons.configuration.ConfigurationMap)2 HashMap (java.util.HashMap)1 Iterator (java.util.Iterator)1 Map (java.util.Map)1