001    /*****************************************************************************
002     * Copyright (c) PicoContainer Organization. All rights reserved.            *
003     * ------------------------------------------------------------------------- *
004     * The software in this package is published under the terms of the BSD      *
005     * style license a copy of which has been included with this distribution in *
006     * the license.html file.                                                    *
007     *                                                                           *
008     * Idea by Rachel Davies, Original code by Aslak Hellesoy and Paul Hammant   *
009     *****************************************************************************/
010    
011    package org.picocontainer;
012    
013    /**
014     * <p>An interface which is implemented by components that can be started and stopped. The {@link Startable#start()}
015     * must be called at the begin of the component lifecycle. It can be called again only after a call to
016     * {@link Startable#stop()}. The {@link Startable#stop()} method must be called at the end of the component lifecycle,
017     * and can further be called after every {@link Startable#start()}. If a component implements the {@link Disposable}
018     * interface as well, {@link Startable#stop()} should be called before {@link Disposable#dispose()}.</p>
019     * <p/>
020     * <p>For more advanced and pluggable lifecycle support, see the functionality offered by picocontainer-gems
021     * subproject.</p>
022     * @see org.picocontainer.Disposable the Disposable interface if you need to <code>dispose()</code> semantics.
023     * @author Paul Hammant
024     * @author Aslak Helles&oslash;y
025     */
026    public interface Startable {
027        /**
028         * Start this component. Called initially at the begin of the lifecycle. It can be called again after a stop.
029         */
030        void start();
031    
032        /**
033         * Stop this component. Called near the end of the lifecycle. It can be called again after a further start. Implement
034         * {@link Disposable} if you need a single call at the definite end of the lifecycle.
035         */
036        void stop();
037    }