Beispiel #1
0
 private void closeBundleManagers() {
   for (BundleManager bundleManager : bundleManagers()) {
     if (!bundleManager.isClosed()) {
       disbandBundleManager(bundleManager);
     }
   }
 }
Beispiel #2
0
 private void disbandModuleSpecification(ModuleSpecification moduleSpecification) {
   if (moduleSpecification != null) {
     BundleManager bundleManager = bundleManager(moduleSpecification);
     if (bundleManager != null && !bundleManager.isClosed()) {
       disbandModuleSpecification(bundleManager, moduleSpecification);
     }
   }
 }
Beispiel #3
0
 private Bundle unmanage(long bundleId) {
   if (isManaged(bundleId)) {
     BundleManager bundleManager = removeBundleManager(bundleId);
     if (bundleManager != null) {
       disbandBundleManager(bundleManager);
       bundleManager.close();
     }
     return bundleManager.getBundle();
   }
   return null;
 }
Beispiel #4
0
 private void disbandModuleSpecification(
     BundleManager bundleManager, ModuleSpecification moduleSpecification) {
   try {
     bundleManager.disband(moduleSpecification);
   } finally {
     serviceStatus(moduleSpecification).becameUnhosted();
   }
 }
Beispiel #5
0
 private void launch(BundleManager bundleManager, ModuleSpecification moduleSpecification) {
   try {
     ObjectManager objectManager = bundleManager.launch(moduleSpecification);
     serviceStatus(moduleSpecification).nowHostedBy(bundleManager);
     log.info(this + " launched " + moduleSpecification + " -> " + objectManager);
   } catch (RuntimeException e) {
     throw new ModuleSystemException(
         this + " failed to launch " + moduleSpecification + " from " + bundleManager, e);
   }
 }
Beispiel #6
0
 private void launch(ModuleSpecification moduleSpecification) {
   BundleManager bundleManager = bundleManager(moduleSpecification);
   if (bundleManager == null) {
     log.info(
         this
             + " received "
             + moduleSpecification
             + ", no object manager factory for that type yet");
   } else if (bundleManager.isClosed()) {
     log.info(
         this
             + " received "
             + moduleSpecification
             + ", object manager factory closed: "
             + bundleManager);
   } else {
     launch(bundleManager, moduleSpecification);
   }
 }
Beispiel #7
0
 private void disbandBundleManager(BundleManager bundleManager) {
   for (String type : bundleManager) {
     for (ServiceStatus serviceStatus : serviceStatii(type)) {
       if (serviceStatus != null && serviceStatus.isHosted()) {
         disbandModuleSpecification(bundleManager, serviceStatus.getModuleSpecification());
       }
     }
   }
   bundleManager.close();
 }
Beispiel #8
0
 private void considerTracking(Bundle bundle) {
   BundleManager existing = bundleManagers.get(bundle.getBundleId());
   if (existing == null) {
     BundleManager bundleManager = BundleManager.manage(bundle, asynch, queuer);
     if (bundleManager != null) {
       storeBundleManager(bundle.getBundleId(), bundleManager);
       launchUnhostedModuleSpecifications(bundleManager);
       log.info(this + " tracks bundle " + bundle + ": " + bundleManager);
     }
   } else {
     log.info(this + " already tracking " + bundle + ": " + existing);
   }
 }