use of org.opendaylight.controller.config.persist.impl.PersisterAggregator in project controller by opendaylight.
the class ConfigPersisterActivator method start.
@Override
public void start(final BundleContext context) throws Exception {
LOG.debug("ConfigPersister starting");
this.context = context;
PropertiesProviderBaseImpl propertiesProvider = new PropertiesProviderBaseImpl(context);
final PersisterAggregator persisterAggregator = PersisterAggregator.createFromProperties(propertiesProvider);
autoCloseables.add(persisterAggregator);
final long maxWaitForCapabilitiesMillis = getMaxWaitForCapabilitiesMillis(propertiesProvider);
final List<ConfigSnapshotHolder> configs = persisterAggregator.loadLastConfigs();
final long conflictingVersionTimeoutMillis = getConflictingVersionTimeoutMillis(propertiesProvider);
LOG.debug("Following configs will be pushed: {}", configs);
ServiceTrackerCustomizer<ConfigSubsystemFacadeFactory, ConfigSubsystemFacadeFactory> schemaServiceTrackerCustomizer = new ServiceTrackerCustomizer<ConfigSubsystemFacadeFactory, ConfigSubsystemFacadeFactory>() {
@Override
public ConfigSubsystemFacadeFactory addingService(final ServiceReference<ConfigSubsystemFacadeFactory> reference) {
LOG.debug("Got addingService(SchemaContextProvider) event");
// Yang store service should not be registered multiple times
ConfigSubsystemFacadeFactory configSubsystemFacadeFactory = reference.getBundle().getBundleContext().getService(reference);
startPusherThread(configs, maxWaitForCapabilitiesMillis, configSubsystemFacadeFactory, conflictingVersionTimeoutMillis, persisterAggregator);
return configSubsystemFacadeFactory;
}
@Override
public void modifiedService(final ServiceReference<ConfigSubsystemFacadeFactory> reference, final ConfigSubsystemFacadeFactory service) {
LOG.warn("Config manager facade was modified unexpectedly");
}
@Override
public void removedService(final ServiceReference<ConfigSubsystemFacadeFactory> reference, final ConfigSubsystemFacadeFactory service) {
LOG.warn("Config manager facade was removed unexpectedly");
}
};
ServiceTracker<ConfigSubsystemFacadeFactory, ConfigSubsystemFacadeFactory> schemaContextProviderServiceTracker = new ServiceTracker<>(context, ConfigSubsystemFacadeFactory.class, schemaServiceTrackerCustomizer);
schemaContextProviderServiceTracker.open();
}
Aggregations