Package org.eclipse.jetty.util.component
Interface Container
-
- All Known Implementing Classes:
ContainerLifeCycle,EatWhatYouKill,ExecutorSizedThreadPool,ExecutorThreadPool,MonitoredQueuedThreadPool,QueuedThreadPool
public interface ContainerA Container
-
-
Nested Class Summary
Nested Classes Modifier and Type Interface Description static interfaceContainer.InheritedListenerInherited Listener.static interfaceContainer.ListenerA listener for Container events.
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description booleanaddBean(Object o)Add a bean.booleanaddBean(Object o, boolean managed)Adds the given bean, explicitly managing it or not.voidaddEventListener(Container.Listener listener)Add an event listener.<T> TgetBean(Class<T> clazz)Collection<Object>getBeans()<T> Collection<T>getBeans(Class<T> clazz)<T> Collection<T>getContainedBeans(Class<T> clazz)booleanisManaged(Object bean)Test if this container manages a beanvoidmanage(Object bean)Manages a bean already contained by this aggregate, so that it is started/stopped/destroyed with this aggregate.booleanremoveBean(Object o)Removes the given bean.voidremoveEventListener(Container.Listener listener)Remove an event listener.voidunmanage(Object bean)Unmanages a bean already contained by this aggregate, so that it is not started/stopped/destroyed with this aggregate.
-
-
-
Method Detail
-
addBean
boolean addBean(Object o)
Add a bean. If the bean is-aContainer.Listener, then also do an implicitaddEventListener(Listener).- Parameters:
o- the bean object to add- Returns:
- true if the bean was added, false if it was already present
-
getBeans
Collection<Object> getBeans()
- Returns:
- the list of beans known to this aggregate
- See Also:
getBean(Class)
-
getBeans
<T> Collection<T> getBeans(Class<T> clazz)
- Type Parameters:
T- the Bean type- Parameters:
clazz- the class of the beans- Returns:
- the list of beans of the given class (or subclass)
- See Also:
getBeans(),getContainedBeans(Class)
-
getBean
<T> T getBean(Class<T> clazz)
- Type Parameters:
T- the Bean type- Parameters:
clazz- the class of the bean- Returns:
- the first bean of a specific class (or subclass), or null if no such bean exist
-
removeBean
boolean removeBean(Object o)
Removes the given bean. If the bean is-aContainer.Listener, then also do an implicitremoveEventListener(Listener).- Parameters:
o- the bean to remove- Returns:
- whether the bean was removed
-
addEventListener
void addEventListener(Container.Listener listener)
Add an event listener.- Parameters:
listener- the listener to add- See Also:
addBean(Object)
-
removeEventListener
void removeEventListener(Container.Listener listener)
Remove an event listener.- Parameters:
listener- the listener to remove- See Also:
removeBean(Object)
-
unmanage
void unmanage(Object bean)
Unmanages a bean already contained by this aggregate, so that it is not started/stopped/destroyed with this aggregate.- Parameters:
bean- The bean to unmanage (must already have been added).
-
manage
void manage(Object bean)
Manages a bean already contained by this aggregate, so that it is started/stopped/destroyed with this aggregate.- Parameters:
bean- The bean to manage (must already have been added).
-
isManaged
boolean isManaged(Object bean)
Test if this container manages a bean- Parameters:
bean- the bean to test- Returns:
- whether this aggregate contains and manages the bean
-
addBean
boolean addBean(Object o, boolean managed)
Adds the given bean, explicitly managing it or not.- Parameters:
o- The bean object to addmanaged- whether to managed the lifecycle of the bean- Returns:
- true if the bean was added, false if it was already present
-
getContainedBeans
<T> Collection<T> getContainedBeans(Class<T> clazz)
- Type Parameters:
T- the Bean type- Parameters:
clazz- the class of the beans- Returns:
- the list of beans of the given class from the entire managed hierarchy
-
-