/** * Stop the components of this PicoContainer and all its logical child containers. * The stopping of the child containers is only attempted for those that have been * started, possibly not successfully. * The lifecycle operation is delegated to the component adapter, * if it is an instance of {@link LifecycleManager lifecycle manager}. * The actual {@link LifecycleStrategy lifecycle strategy} supported * depends on the concrete implementation of the adapter. * * @see LifecycleManager * @see LifecycleStrategy * @see #makeChildContainer() * @see #addChildContainer(PicoContainer) * @see #removeChildContainer(PicoContainer) */ public void stop() { if (disposed) throw new IllegalStateException("Already disposed"); if (!started) throw new IllegalStateException("Not started"); for (Iterator iterator = children.iterator(); iterator.hasNext();) { PicoContainer child = (PicoContainer) iterator.next(); if ( childStarted(child) ){ child.stop(); } } this.lifecycleManager.stop(this); started = false; }