1 /***************************************************************************** 2 * Copyright (c) PicoContainer Organization. All rights reserved. * 3 * ------------------------------------------------------------------------- * 4 * The software in this package is published under the terms of the BSD * 5 * style license a copy of which has been included with this distribution in * 6 * the license.html file. * 7 * * 8 * Idea by Rachel Davies, Original code by Aslak Hellesoy and Paul Hammant * 9 *****************************************************************************/ 10 11 package org.picocontainer; 12 13 /** 14 * <p>An interface which is implemented by components that can be started and stopped. The {@link Startable#start()} 15 * must be called at the begin of the component lifecycle. It can be called again only after a call to 16 * {@link Startable#stop()}. The {@link Startable#stop()} method must be called at the end of the component lifecycle, 17 * and can further be called after every {@link Startable#start()}. If a component implements the {@link Disposable} 18 * interface as well, {@link Startable#stop()} should be called before {@link Disposable#dispose()}.</p> 19 * <p/> 20 * <p>For more advanced and pluggable lifecycle support, see the functionality offered by the nanocontainer-proxytoys 21 * subproject.</p> 22 * @version $Revision: 1593 $ 23 * @see org.picocontainer.Disposable the Disposable interface if you need to <code>dispose()</code> semantics. 24 * @author Paul Hammant 25 * @author Aslak Hellesøy 26 * @since 1.0 27 */ 28 public interface Startable { 29 /** 30 * Start this component. Called initially at the begin of the lifecycle. It can be called again after a stop. 31 */ 32 void start(); 33 34 /** 35 * Stop this component. Called near the end of the lifecycle. It can be called again after a further start. Implement 36 * {@link Disposable} if you need a single call at the definite end of the lifecycle. 37 */ 38 void stop(); 39 } 40