@Override public void disposeComponent(String componentObject) { ComponentInstance componentInstance = componentInstances.get(componentObject); if (componentInstance != null) componentInstance.dispose(); } }
/** * Callend when any of the SCR Components required dependencies become unsatisfied. */ @Deactivate public void deactivate() { LOG.info("Deactivating the {}", COMPONENT_LABEL); try { lock.readLock().lock(); greeterService.stopGreeter(); instance.dispose(); } finally { lock.readLock().unlock(); } }
log.info("deactivate Referenced Site {}", siteConfiguration.getName()); if (this.dereferencerComponentInstance != null) { this.dereferencerComponentInstance.dispose(); this.dereferencerComponentInstance = null; this.entitySearcherComponentInstance.dispose(); this.entitySearcherComponentInstance = null;
log.info("deactivate Referenced Site {}", siteConfiguration.getName()); if (this.dereferencerComponentInstance != null) { this.dereferencerComponentInstance.dispose(); this.dereferencerComponentInstance = null; this.entitySearcherComponentInstance.dispose(); this.entitySearcherComponentInstance = null;
@Component(immediate=true) @Instantiate public class Controller { @Requires(filter="(factory.name=A)") Factory factoryOfA; @Requires(filter="(factory.name=B)") Factory factoryOfB; ComponentInstance instance; @Validate public void createA() throws Exception { instance = factoryOfA.createInstance(null); } public void switchToB() throws Exception { instance.dispose(); instance = factoryOfB.createInstance(null); } }