- bundleTracker.open();
-
- // register config registry to OSGi
- AutoCloseable configRegReg = registerService(context, configRegistry, ConfigRegistryImpl.class);
-
- // register config registry to jmx
- ConfigRegistryJMXRegistrator configRegistryJMXRegistrator = new ConfigRegistryJMXRegistrator(configMBeanServer);
- try {
- configRegistryJMXRegistrator.registerToJMX(configRegistry);
- } catch (InstanceAlreadyExistsException e) {
- throw new IllegalStateException("Config Registry was already registered to JMX", e);
+ bundleTracker.open();
+
+ // Wrap config registry with JMX notification publishing adapter
+ final JMXNotifierConfigRegistry notifyingConfigRegistry =
+ new JMXNotifierConfigRegistry(configRegistry, configMBeanServer);
+
+ // register config registry to OSGi
+ AutoCloseable clsReg = registerService(context, moduleInfoBackedContext, GeneratedClassLoadingStrategy.class);
+ AutoCloseable configRegReg = registerService(context, notifyingConfigRegistry, ConfigRegistry.class);
+
+ // register config registry to jmx
+ ConfigRegistryJMXRegistrator configRegistryJMXRegistrator = new ConfigRegistryJMXRegistrator(configMBeanServer);
+ try {
+ configRegistryJMXRegistrator.registerToJMXNoNotifications(configRegistry);
+ } catch (InstanceAlreadyExistsException e) {
+ throw new IllegalStateException("Config Registry was already registered to JMX", e);
+ }
+
+ // register config registry to jmx
+ final ConfigRegistryJMXRegistrator configRegistryJMXRegistratorWithNotifications = new ConfigRegistryJMXRegistrator(configMBeanServer);
+ try {
+ configRegistryJMXRegistrator.registerToJMX(notifyingConfigRegistry);
+ } catch (InstanceAlreadyExistsException e) {
+ throw new IllegalStateException("Config Registry was already registered to JMX", e);
+ }
+
+ // TODO wire directly via moduleInfoBundleTracker
+ ServiceTracker<ModuleFactory, Object> serviceTracker = new ServiceTracker<>(context, ModuleFactory.class,
+ blankTransactionServiceTracker);
+ serviceTracker.open();
+
+ List<AutoCloseable> list = Arrays.asList(bindingContextProvider, clsReg, configRegistry, wrap(bundleTracker),
+ configRegReg, configRegistryJMXRegistrator, configRegistryJMXRegistratorWithNotifications, wrap(serviceTracker), moduleInfoRegistryWrapper, notifyingConfigRegistry);
+ autoCloseable = OsgiRegistrationUtil.aggregate(list);
+ } catch(Exception e) {
+ LOG.warn("Error starting config manager", e);