426897 improved ContainerLifeCycle javadoc

This commit is contained in:
Greg Wilkins 2014-03-20 12:43:36 +11:00
parent 0d876de759
commit 0b1c4b6d8b
1 changed files with 11 additions and 3 deletions

View File

@ -36,9 +36,17 @@ import org.eclipse.jetty.util.log.Logger;
* Beans can be added the ContainerLifeCycle either as managed beans or as unmanaged beans. A managed bean is started, stopped and destroyed with the aggregate. * Beans can be added the ContainerLifeCycle either as managed beans or as unmanaged beans. A managed bean is started, stopped and destroyed with the aggregate.
* An unmanaged bean is associated with the aggregate for the purposes of {@link #dump()}, but it's lifecycle must be managed externally. * An unmanaged bean is associated with the aggregate for the purposes of {@link #dump()}, but it's lifecycle must be managed externally.
* <p> * <p>
* When a {@link LifeCycle} bean is added with out a managed state being specified, if it is already started, then it is assumed to be an unmanaged bean. * When a {@link LifeCycle} bean is added without a managed state being specified the state is determined heuristically:
* If it is not started then it is added in and auto managed state, which means that when this bean is itself started, it if must also start the added bean, then it * <ul>
* is switched from Auto to be a managed bean. Otherwise it becomes an unmanaged bean. Simply put an Auto bean will be stopped by this aggregate only if it * <li>If when added, a bean is already started, then it is assumed to be an unmanaged bean.
* <li>If when added, a bean is not started, then it is added in Auto state.
* </ul>
* When the container is started, then all contained managed beans will also be started. Any contained Auto beans
* will be check for their status and if already started will be switched unmanaged beans, else they will be
* started and switched to managed beans. Beans added after a container is started are not started and their state needs to
* be explicitly managed.
* <p>
* When stopping the container, a contained bean will be stopped by this aggregate only if it
* is started by this aggregate. * is started by this aggregate.
* <p> * <p>
* The methods {@link #addBean(Object, boolean)}, {@link #manage(Object)} and {@link #unmanage(Object)} can be used to * The methods {@link #addBean(Object, boolean)}, {@link #manage(Object)} and {@link #unmanage(Object)} can be used to