@ManagedObject(value="Implementation of Container and LifeCycle") public class ContainerLifeCycle extends AbstractLifeCycle implements Container, Destroyable, Dumpable
AbstractLifeCycle.AbstractLifeCycleListenerContainer.InheritedListener, Container.ListenerLifeCycle.Listener| Constructor and Description |
|---|
ContainerLifeCycle() |
| Modifier and Type | Method and Description |
|---|---|
boolean |
addBean(Object o)
Adds the given bean, detecting whether to manage it or not.
|
boolean |
addBean(Object o,
boolean managed)
Adds the given bean, explicitly managing it or not.
|
boolean |
addBean(Object o,
org.eclipse.jetty.util.component.ContainerLifeCycle.Managed managed) |
void |
addEventListener(Container.Listener listener)
Add an event listener.
|
void |
addManaged(LifeCycle lifecycle)
Add a managed lifecycle.
|
boolean |
contains(Object bean) |
void |
destroy()
Destroys the managed Destroyable beans in the reverse order they were added.
|
protected void |
doStart()
Starts the managed lifecycle beans in the order they were added.
|
protected void |
doStop()
Stops the managed lifecycle beans in the reverse order they were added.
|
String |
dump() |
void |
dump(Appendable out) |
void |
dump(Appendable out,
String indent) |
static void |
dump(Appendable out,
String indent,
Collection<?>... collections) |
static String |
dump(Dumpable dumpable) |
protected void |
dumpBeans(Appendable out,
String indent,
Collection<?>... collections) |
static void |
dumpObject(Appendable out,
Object o) |
void |
dumpStdErr()
Dumps to
System.err. |
protected void |
dumpThis(Appendable out) |
<T> T |
getBean(Class<T> clazz) |
Collection<Object> |
getBeans() |
<T> Collection<T> |
getBeans(Class<T> clazz) |
boolean |
isManaged(Object bean) |
void |
manage(Object bean)
Manages a bean already contained by this aggregate, so that it is started/stopped/destroyed with this
aggregate.
|
boolean |
removeBean(Object o)
Removes the given bean.
|
void |
removeBeans()
Removes all bean
|
void |
removeEventListener(Container.Listener listener)
Remove an event listener.
|
void |
setBeans(Collection<Object> beans) |
void |
setStopTimeout(long stopTimeout) |
protected void |
start(LifeCycle l)
Starts the given lifecycle.
|
protected void |
stop(LifeCycle l)
Stops the given lifecycle.
|
void |
unmanage(Object bean)
Unmanages a bean already contained by this aggregate, so that it is not started/stopped/destroyed with this
aggregate.
|
void |
updateBean(Object oldBean,
Object newBean) |
void |
updateBeans(Object[] oldBeans,
Object[] newBeans) |
addLifeCycleListener, getState, getState, getStopTimeout, isFailed, isRunning, isStarted, isStarting, isStopped, isStopping, removeLifeCycleListener, start, stopprotected void doStart()
throws Exception
doStart in class AbstractLifeCycleExceptionprotected void start(LifeCycle l) throws Exception
l - Exceptionprotected void stop(LifeCycle l) throws Exception
l - Exceptionprotected void doStop()
throws Exception
doStop in class AbstractLifeCycleExceptionpublic void destroy()
destroy in interface Destroyablepublic boolean contains(Object bean)
bean - the bean to testpublic boolean isManaged(Object bean)
bean - the bean to testpublic boolean addBean(Object o)
LifeCycle, then it will be managed if it is not
already started and not managed if it is already started.
The addBean(Object, boolean)
method should be used if this is not correct, or the manage(Object) and unmanage(Object)
methods may be used after an add to change the status.public boolean addBean(Object o, boolean managed)
o - The bean object to addmanaged - whether to managed the lifecycle of the beanpublic boolean addBean(Object o, org.eclipse.jetty.util.component.ContainerLifeCycle.Managed managed)
public void addManaged(LifeCycle lifecycle)
This is a conveniance method that uses addBean(lifecycle,true) and then ensures that the added bean is started iff this container is running. Exception from nested calls to start are caught and wrapped as RuntimeExceptions
lifecycle - public void addEventListener(Container.Listener listener)
ContaineraddEventListener in interface ContainerContainer.addBean(Object)public void manage(Object bean)
bean - The bean to manage (must already have been added).public void unmanage(Object bean)
bean - The bean to unmanage (must already have been added).public Collection<Object> getBeans()
getBeans in interface ContainerContainer.getBean(Class)public void setBeans(Collection<Object> beans)
public <T> Collection<T> getBeans(Class<T> clazz)
getBeans in interface Containerclazz - the class of the beansContainer.getBeans()public <T> T getBean(Class<T> clazz)
public void removeBeans()
public boolean removeBean(Object o)
ContainerContainer.Listener, then also do an implicit Container.removeEventListener(Listener).removeBean in interface Containerpublic void removeEventListener(Container.Listener listener)
ContainerremoveEventListener in interface ContainerContainer.removeBean(Object)public void setStopTimeout(long stopTimeout)
setStopTimeout in class AbstractLifeCycle@ManagedOperation(value="Dump the object to stderr") public void dumpStdErr()
System.err.dump()@ManagedOperation(value="Dump the object to a string") public String dump()
public void dump(Appendable out) throws IOException
IOExceptionprotected void dumpThis(Appendable out) throws IOException
IOExceptionpublic static void dumpObject(Appendable out, Object o) throws IOException
IOExceptionpublic void dump(Appendable out, String indent) throws IOException
dump in interface DumpableIOExceptionprotected void dumpBeans(Appendable out, String indent, Collection<?>... collections) throws IOException
IOExceptionpublic static void dump(Appendable out, String indent, Collection<?>... collections) throws IOException
IOExceptionCopyright © 1995-2015 Webtide. All Rights Reserved.