@Override
public void start(final BundleContext context) {
+ LOG.info("Config manager starting...");
try {
// the inner strategy is backed by thread context cl?
final ModuleInfoBackedContext moduleInfoBackedContext = ModuleInfoBackedContext.create();
final BindingContextProvider bindingContextProvider = new BindingContextProvider();
final RefreshingSCPModuleInfoRegistry moduleInfoRegistryWrapper = new RefreshingSCPModuleInfoRegistry(
- moduleInfoBackedContext, moduleInfoBackedContext, moduleInfoBackedContext, moduleInfoBackedContext, bindingContextProvider, context);
+ moduleInfoBackedContext, moduleInfoBackedContext, moduleInfoBackedContext, moduleInfoBackedContext,
+ bindingContextProvider, context);
- final ModuleInfoBundleTracker moduleInfoBundleTracker = new ModuleInfoBundleTracker(context, moduleInfoRegistryWrapper);
+ final ModuleInfoBundleTracker moduleInfoBundleTracker = new ModuleInfoBundleTracker(moduleInfoRegistryWrapper);
// start config registry
- final BundleContextBackedModuleFactoriesResolver bundleContextBackedModuleFactoriesResolver = new BundleContextBackedModuleFactoriesResolver(
- context);
- this.configRegistry = new ConfigRegistryImpl(bundleContextBackedModuleFactoriesResolver, this.configMBeanServer,
- bindingContextProvider);
+ final BundleContextBackedModuleFactoriesResolver bundleContextBackedModuleFactoriesResolver =
+ new BundleContextBackedModuleFactoriesResolver(context);
+ this.configRegistry = new ConfigRegistryImpl(bundleContextBackedModuleFactoriesResolver,
+ this.configMBeanServer, bindingContextProvider);
// track bundles containing factories
final BlankTransactionServiceTracker blankTransactionServiceTracker = new BlankTransactionServiceTracker(
new JMXNotifierConfigRegistry(this.configRegistry, this.configMBeanServer);
// register config registry to OSGi
- final AutoCloseable clsReg = OsgiRegistrationUtil.registerService(context, moduleInfoBackedContext, ClassLoadingStrategy.class);
- final AutoCloseable configRegReg = OsgiRegistrationUtil.registerService(context, notifyingConfigRegistry, ConfigRegistry.class);
+ final AutoCloseable clsReg = OsgiRegistrationUtil.registerService(context, moduleInfoBackedContext,
+ ClassLoadingStrategy.class);
+ final AutoCloseable configRegReg = OsgiRegistrationUtil.registerService(context, notifyingConfigRegistry,
+ ConfigRegistry.class);
// register config registry to jmx
- final ConfigRegistryJMXRegistrator configRegistryJMXRegistrator = new ConfigRegistryJMXRegistrator(this.configMBeanServer);
+ final ConfigRegistryJMXRegistrator configRegistryJMXRegistrator =
+ new ConfigRegistryJMXRegistrator(this.configMBeanServer);
try {
configRegistryJMXRegistrator.registerToJMXNoNotifications(this.configRegistry);
} catch (final InstanceAlreadyExistsException e) {
}
// register config registry to jmx
- final ConfigRegistryJMXRegistrator configRegistryJMXRegistratorWithNotifications = new ConfigRegistryJMXRegistrator(this.configMBeanServer);
+ final ConfigRegistryJMXRegistrator configRegistryJMXRegistratorWithNotifications =
+ new ConfigRegistryJMXRegistrator(this.configMBeanServer);
try {
configRegistryJMXRegistrator.registerToJMX(notifyingConfigRegistry);
} catch (final InstanceAlreadyExistsException e) {
}
// TODO wire directly via moduleInfoBundleTracker
- final ServiceTracker<ModuleFactory, Object> serviceTracker = new ServiceTracker<>(context, ModuleFactory.class,
- blankTransactionServiceTracker);
+ final ServiceTracker<ModuleFactory, Object> serviceTracker = new ServiceTracker<>(context,
+ ModuleFactory.class, blankTransactionServiceTracker);
serviceTracker.open();
- final AutoCloseable configMgrReg = OsgiRegistrationUtil.registerService(context, this, ConfigSystemService.class);
+ final AutoCloseable configMgrReg = OsgiRegistrationUtil.registerService(context, this,
+ ConfigSystemService.class);
final List<AutoCloseable> list = Arrays.asList(bindingContextProvider, clsReg,
OsgiRegistrationUtil.wrap(moduleFactoryBundleTracker), moduleInfoBundleTracker,
configRegReg, configRegistryJMXRegistrator, configRegistryJMXRegistratorWithNotifications,
- OsgiRegistrationUtil.wrap(serviceTracker), moduleInfoRegistryWrapper, notifyingConfigRegistry, configMgrReg);
+ OsgiRegistrationUtil.wrap(serviceTracker), moduleInfoRegistryWrapper, notifyingConfigRegistry,
+ configMgrReg);
this.autoCloseable = OsgiRegistrationUtil.aggregate(list);
context.addBundleListener(this);
} catch(final Exception e) {
- LOG.warn("Error starting config manager", e);
+ LOG.error("Error starting config manager", e);
} catch(final Error e) {
// Log JVM Error and re-throw. The OSGi container may silently fail the bundle and not always log
// the exception. This has been seen on initial feature install.
LOG.error("Error starting config manager", e);
throw e;
}
+
+ LOG.info("Config manager start complete");
}
@Override
public void stop(final BundleContext context) throws Exception {
+ LOG.info("Config manager stopping");
context.removeBundleListener(this);
this.autoCloseable.close();
}