org.picocontainer.gems.containers
Class ReusablePicoContainer
java.lang.Object
org.picocontainer.DefaultPicoContainer
org.picocontainer.gems.containers.ReusablePicoContainer
- All Implemented Interfaces:
- Serializable, ComponentMonitorStrategy, Converting, Disposable, MutablePicoContainer, PicoContainer, Startable
public class ReusablePicoContainer
- extends DefaultPicoContainer
Normal PicoContainers are meant to be created, started, stopped, disposed and
garbage collected. The goal of this container is to reduce the number of
registration calls (and therefore objects created) in areas where performance
is key (for example, this might be used in NanoContainer request containers).
It accomplishes its goal in two ways:
(1) Once a container is disposed
of, start() may be called again, allowing for recycling of the container. (This is default
behavior with a picocontainer)
(2) All instance registrations will be unregistered when stop is called. (For example,
HttpServletRequest would be removed), and all component adapter instance values
are flushed.
Container Storage
It is still up to the builder of this container to decide where to store its reference. Since
it is reusable, it needs to be stored someplace that doesn't easily expire. Probably the most
common storage location would be ThreadLocal storage. HttpSession might be another valid
storage location.
- Author:
- Michael Rimov
- See Also:
- Serialized Form
Constructor Summary |
ReusablePicoContainer()
|
ReusablePicoContainer(ComponentFactory componentFactory)
|
ReusablePicoContainer(ComponentFactory componentFactory,
LifecycleStrategy lifecycleStrategy,
PicoContainer parent)
|
ReusablePicoContainer(ComponentFactory componentFactory,
LifecycleStrategy lifecycleStrategy,
PicoContainer parent,
ComponentMonitor componentMonitor)
|
ReusablePicoContainer(ComponentFactory componentFactory,
PicoContainer parent)
|
ReusablePicoContainer(ComponentMonitor monitor)
|
ReusablePicoContainer(ComponentMonitor monitor,
LifecycleStrategy lifecycleStrategy,
PicoContainer parent)
|
ReusablePicoContainer(ComponentMonitor monitor,
PicoContainer parent)
|
ReusablePicoContainer(LifecycleStrategy lifecycleStrategy,
PicoContainer parent)
|
ReusablePicoContainer(PicoContainer parent)
|
Methods inherited from class org.picocontainer.DefaultPicoContainer |
accept, addAdapterInternal, addChildContainer, addConfig, as, change, changeMonitor, currentMonitor, decorateComponent, dispose, getComponent, getComponent, getComponent, getComponent, getComponent, getComponentAdapter, getComponentAdapter, getComponentAdapter, getComponentAdapters, getComponentAdapters, getComponentAdapters, getComponentKeyToAdapterCache, getComponents, getComponents, getConverters, getModifiableComponentAdapterList, getOrderedComponentAdapters, getParent, instantiateComponentAsIsStartable, potentiallyStartAdapter, removeChildContainer, setLifecycleState, setName, start, toString |
ReusablePicoContainer
public ReusablePicoContainer()
ReusablePicoContainer
public ReusablePicoContainer(ComponentFactory componentFactory,
LifecycleStrategy lifecycleStrategy,
PicoContainer parent,
ComponentMonitor componentMonitor)
ReusablePicoContainer
public ReusablePicoContainer(ComponentFactory componentFactory,
LifecycleStrategy lifecycleStrategy,
PicoContainer parent)
ReusablePicoContainer
public ReusablePicoContainer(ComponentFactory componentFactory,
PicoContainer parent)
ReusablePicoContainer
public ReusablePicoContainer(ComponentFactory componentFactory)
ReusablePicoContainer
public ReusablePicoContainer(ComponentMonitor monitor,
LifecycleStrategy lifecycleStrategy,
PicoContainer parent)
ReusablePicoContainer
public ReusablePicoContainer(ComponentMonitor monitor,
PicoContainer parent)
ReusablePicoContainer
public ReusablePicoContainer(ComponentMonitor monitor)
ReusablePicoContainer
public ReusablePicoContainer(LifecycleStrategy lifecycleStrategy,
PicoContainer parent)
ReusablePicoContainer
public ReusablePicoContainer(PicoContainer parent)
addComponent
public MutablePicoContainer addComponent(Object componentKey,
Object componentImplementationOrInstance,
Parameter... parameters)
throws PicoCompositionException
- Specified by:
addComponent
in interface MutablePicoContainer
- Overrides:
addComponent
in class DefaultPicoContainer
- Throws:
PicoCompositionException
addComponent
public MutablePicoContainer addComponent(Object implOrInstance)
throws PicoCompositionException
- Specified by:
addComponent
in interface MutablePicoContainer
- Overrides:
addComponent
in class DefaultPicoContainer
- Throws:
PicoCompositionException
stop
public void stop()
- Specified by:
stop
in interface Startable
- Overrides:
stop
in class DefaultPicoContainer
addAdapter
public MutablePicoContainer addAdapter(ComponentAdapter<?> componentAdapter,
Properties properties)
- Overrides:
addAdapter
in class DefaultPicoContainer
addAdapter
public MutablePicoContainer addAdapter(ComponentAdapter<?> componentAdapter)
- Specified by:
addAdapter
in interface MutablePicoContainer
- Overrides:
addAdapter
in class DefaultPicoContainer
removeComponent
public <T> ComponentAdapter<T> removeComponent(Object componentKey)
- Specified by:
removeComponent
in interface MutablePicoContainer
- Overrides:
removeComponent
in class DefaultPicoContainer
removeComponentByInstance
public <T> ComponentAdapter<T> removeComponentByInstance(T componentInstance)
- Specified by:
removeComponentByInstance
in interface MutablePicoContainer
- Overrides:
removeComponentByInstance
in class DefaultPicoContainer
makeChildContainer
public MutablePicoContainer makeChildContainer()
- Specified by:
makeChildContainer
in interface MutablePicoContainer
- Overrides:
makeChildContainer
in class DefaultPicoContainer
Copyright © 2003-2010 Codehaus. All Rights Reserved.