use of com.twitter.distributedlog.config.FileConfigurationBuilder in project distributedlog by twitter.
the class DynamicConfigurationFeatureProvider method start.
@Override
public void start() throws IOException {
List<FileConfigurationBuilder> fileConfigBuilders = Lists.newArrayListWithExpectedSize(2);
String baseConfigPath = conf.getFileFeatureProviderBaseConfigPath();
Preconditions.checkNotNull(baseConfigPath);
File baseConfigFile = new File(baseConfigPath);
FileConfigurationBuilder baseProperties = new PropertiesConfigurationBuilder(baseConfigFile.toURI().toURL());
fileConfigBuilders.add(baseProperties);
String overlayConfigPath = conf.getFileFeatureProviderOverlayConfigPath();
if (null != overlayConfigPath) {
File overlayConfigFile = new File(overlayConfigPath);
FileConfigurationBuilder overlayProperties = new PropertiesConfigurationBuilder(overlayConfigFile.toURI().toURL());
fileConfigBuilders.add(overlayProperties);
}
try {
this.featuresConfSubscription = new ConfigurationSubscription(this.featuresConf, fileConfigBuilders, executorService, conf.getDynamicConfigReloadIntervalSec(), TimeUnit.SECONDS);
} catch (ConfigurationException e) {
throw new IOException("Failed to register subscription on features configuration");
}
this.featuresConfSubscription.registerListener(this);
}
Aggregations