Keep old OSGi service registration when reusing old instance. Also move @Deprecated flag in ModuleInternalTransactionalInfo where it belongs.
Change-Id: I1e6f75f9ac225dd6149e24adb3713e2b2ed8dc50
Signed-off-by: Tomas Olvecky <tolvecky@cisco.com>
ModuleJMXRegistrator newModuleJMXRegistrator = baseJMXRegistrator
.createModuleJMXRegistrator();
ModuleJMXRegistrator newModuleJMXRegistrator = baseJMXRegistrator
.createModuleJMXRegistrator();
+ OsgiRegistration osgiRegistration = null;
if (entry.hasOldModule()) {
ModuleInternalInfo oldInternalInfo = entry.getOldInternalInfo();
DynamicReadableWrapper oldReadableConfigBean = oldInternalInfo
if (entry.hasOldModule()) {
ModuleInternalInfo oldInternalInfo = entry.getOldInternalInfo();
DynamicReadableWrapper oldReadableConfigBean = oldInternalInfo
currentConfig.remove(entry.getName());
// test if old instance == new instance
currentConfig.remove(entry.getName());
// test if old instance == new instance
- if (oldReadableConfigBean.getInstance().equals(
- module.getInstance())) {
+ if (oldReadableConfigBean.getInstance().equals(module.getInstance())) {
// reused old instance:
// wrap in readable dynamic mbean
reusedInstances.add(primaryReadOnlyON);
// reused old instance:
// wrap in readable dynamic mbean
reusedInstances.add(primaryReadOnlyON);
+ osgiRegistration = oldInternalInfo.getOsgiRegistration();
} else {
// recreated instance:
// it is responsibility of module to call the old instance -
// we just need to unregister configbean
recreatedInstances.add(primaryReadOnlyON);
} else {
// recreated instance:
// it is responsibility of module to call the old instance -
// we just need to unregister configbean
recreatedInstances.add(primaryReadOnlyON);
+
+ // close old osgi registration
+ oldInternalInfo.getOsgiRegistration().close();
- // close old osgi registration in any case
- oldInternalInfo.getOsgiRegistration().close();
// close old module jmx registrator
oldInternalInfo.getModuleJMXRegistrator().close();
} else {
// close old module jmx registrator
oldInternalInfo.getModuleJMXRegistrator().close();
} else {
- OsgiRegistration osgiRegistration = beanToOsgiServiceManager
- .registerToOsgi(module.getClass(),
- newReadableConfigBean.getInstance(),
- entry.getName());
+ if (osgiRegistration == null) {
+ osgiRegistration = beanToOsgiServiceManager.registerToOsgi(module.getClass(),
+ newReadableConfigBean.getInstance(), entry.getName());
+ }
RootRuntimeBeanRegistratorImpl runtimeBeanRegistrator = runtimeRegistrators
.get(entry.getName());
RootRuntimeBeanRegistratorImpl runtimeBeanRegistrator = runtimeRegistrators
.get(entry.getName());
this.transactionModuleJMXRegistration = transactionModuleJMXRegistration;
}
this.transactionModuleJMXRegistration = transactionModuleJMXRegistration;
}
+
+ /**
+ * Use {@link #getIdentifier()} instead.
+ */
+ @Deprecated
public ModuleIdentifier getName() {
return name;
}
public ModuleIdentifier getName() {
return name;
}
maybeOldInternalInfo.getOrderingIdx());
}
maybeOldInternalInfo.getOrderingIdx());
}
public Module getModule() {
return module;
}
public Module getModule() {
return module;
}