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 * @version $Revision: 2281 $
023 * @see org.picocontainer.Disposable the Disposable interface if you need to <code>dispose()</code> semantics.
024 * @author Paul Hammant
025 * @author Aslak Hellesøy
026 * @since 1.0
027 */
028 public interface Startable {
029 /**
030 * Start this component. Called initially at the begin of the lifecycle. It can be called again after a stop.
031 */
032 void start();
033
034 /**
035 * Stop this component. Called near the end of the lifecycle. It can be called again after a further start. Implement
036 * {@link Disposable} if you need a single call at the definite end of the lifecycle.
037 */
038 void stop();
039 }