public synchronized void shutdown() { for (Module m : modules.values()) { // Only stop modules that were started after ModulesRegistry // came into existence. if (OSGiModuleImpl.class.cast(m).isTransientlyActive()) { m.stop(); } } // Save the cache before clearing modules try { cache.saveCache(); } catch (IOException e) { Logger.logger.log(Level.WARNING, "Cannot save metadata to cache", e); } bctx.removeBundleListener(this); super.shutdown(); }
public synchronized void shutdown() { for (Module m : modules.values()) { // Only stop modules that were started after ModulesRegistry // came into existence. if (OSGiModuleImpl.class.cast(m).isTransientlyActive()) { m.stop(); } } // Save the cache before clearing modules try { if (cacheInvalidated) { saveCache(); } } catch (IOException e) { Logger.logger.log(Level.WARNING, "Cannot save metadata to cache", e); } modules.clear(); for (Repository repo : repositories.values()) { try { repo.shutdown(); } catch(Exception e) { java.util.logging.Logger.getAnonymousLogger().log(Level.SEVERE, "Error while closing repository " + repo, e); // swallows } } // don't try to stop the system bundle, as we may be embedded inside // something like Eclipse. }
public void stopDomain() { final ModulesRegistry registry = InjectedValues.getInstance().getModulesRegistry(); final Collection<Module> modules = registry.getModules("com.sun.enterprise.osgi-adapter"); if (modules.size() == 1) { final Module mgmtAgentModule = modules.iterator().next(); mgmtAgentModule.stop(); } else { AMXLoggerInfo.getLogger().warning(AMXLoggerInfo.cantFindOSGIAdapter); } AMXLoggerInfo.getLogger().warning(AMXLoggerInfo.stoppingServerForcibly); System.exit(0); }