/** * Collect and store in m_dependencies_map all the services for dependencies, outside of any * locks. Throwing IllegalStateException on failure to collect all the dependencies is needed so * getService can know to return null. * * @return true if this thread collected the dependencies; false if some other thread successfully * collected the dependencies; * @throws IllegalStateException if some dependency is no longer available. */ protected boolean collectDependencies() throws IllegalStateException { if (m_dependenciesCollected) { log( LogService.LOG_DEBUG, "dependencies already collected, do not collect dependencies", null); return false; } initDependencyManagers(); for (DependencyManager<S, ?> dependencyManager : m_dependencyManagers) { if (!dependencyManager.prebind()) { // not actually satisfied any longer deactivateDependencyManagers(); log( LogService.LOG_DEBUG, "Could not get required dependency for dependency manager: {0}", new Object[] {dependencyManager.getName()}, null); throw new IllegalStateException("Missing dependencies, not satisfied"); } } m_dependenciesCollected = true; log(LogService.LOG_DEBUG, "This thread collected dependencies", null); return true; }
final void doDeactivate(int reason, boolean disable) { try { if (!unregisterService()) { log(LogService.LOG_DEBUG, "Component deactivation occuring on another thread", null); } obtainStateLock("AbstractComponentManager.State.doDeactivate.1"); try { if (m_activated) { m_activated = false; deleteComponent(reason); deactivateDependencyManagers(); if (disable) { disableDependencyManagers(); } unsetDependenciesCollected(); } } finally { releaseStateLock("AbstractComponentManager.State.doDeactivate.1"); } } catch (Throwable t) { log(LogService.LOG_WARNING, "Component deactivation threw an exception", t); } }