+ private Module resolveModuleInstance(final ObjectName dependentReadOnlyON, final JmxAttribute jmxAttribute) {
+ Preconditions.checkArgument(dependentReadOnlyON != null, "dependentReadOnlyON");
+ Preconditions.checkArgument(jmxAttribute != null, "jmxAttribute");
+ final ObjectName translatedDependentReadOnlyON = translateServiceRefIfPossible(dependentReadOnlyON);
+ this.transactionStatus.checkCommitStarted();
+ this.transactionStatus.checkNotCommitted();
+
+ final ModuleIdentifier dependentModuleIdentifier = ObjectNameUtil.fromON(translatedDependentReadOnlyON,
+ ObjectNameUtil.TYPE_MODULE);
+
+ return Preconditions.checkNotNull(this.modulesHolder.findModule(dependentModuleIdentifier, jmxAttribute));
+ }
+
+ @Override
+ public boolean canReuseDependency(final ObjectName objectName, final JmxAttribute jmxAttribute) {
+ Preconditions.checkNotNull(objectName);
+ Preconditions.checkNotNull(jmxAttribute);
+
+ final Module currentModule = resolveModuleInstance(objectName, jmxAttribute);
+ final ModuleIdentifier identifier = currentModule.getIdentifier();
+ final ModuleInternalTransactionalInfo moduleInternalTransactionalInfo = this.modulesHolder
+ .findModuleInternalTransactionalInfo(identifier);
+
+ if (moduleInternalTransactionalInfo.hasOldModule()) {
+ final Module oldModule = moduleInternalTransactionalInfo.getOldInternalInfo().getReadableModule()
+ .getModule();
+ return currentModule.canReuse(oldModule);
+ }
+ return false;
+ }
+