Class DelegatingPersistenceManager

java.lang.Object
org.codice.felix.cm.file.WrappedPersistenceManager
org.codice.felix.cm.file.DelegatingPersistenceManager
All Implemented Interfaces:
AutoCloseable, org.apache.felix.cm.PersistenceManager

public class DelegatingPersistenceManager extends WrappedPersistenceManager
The DelegatingPersistenceManager is responsible for iterating over relevant configuration plugin points prior to moving the configs to the inner PersistenceManager.

Read locks are maintained during configuration persistence and removal so that initializing plugins do not miss configuration data.

By implementing ServiceTrackerCustomizer callbacks are provided for plugin initialization to occur. The implementation is expressed in an inner class DelegatingPersistenceManager.PluginTrackerCustomizer.

Plugin initialization delivers the list of all known configurations to the plugins so they can prepare for future updates and deletions. The serviceStartingLock ensures no additional configuration is persisted or removed while configuration plugins are being initialized, the consequences of which could mean plugins miss configuration and fall out of sync with the data cache.

For plugin initialization, we read configuration data from the inner persistence manager directly to avoid lock contention with the caching layer that Felix adds in the ConfigurationManager. This means reading all the config admin configuration data from disk every time a ConfigurationPersistencePlugin needs to initialize.

Also relevant: https://github.com/codice/ddf/pull/2523#discussion_r150092423

See FELIX-4005 & FELIX-4556. This class cannot utilize Java 8 language constructs due to maven bundle plugin 2.3.7