org.picocontainer.gems.adapters
Class ThreadLocalized<T>
java.lang.Object
org.picocontainer.behaviors.AbstractBehavior<T>
org.picocontainer.gems.adapters.ThreadLocalized<T>
- All Implemented Interfaces:
- Serializable, org.picocontainer.Behavior<T>, org.picocontainer.ComponentAdapter<T>, org.picocontainer.ComponentLifecycle<T>, org.picocontainer.ComponentMonitorStrategy, org.picocontainer.LifecycleStrategy
public final class ThreadLocalized<T>
- extends org.picocontainer.behaviors.AbstractBehavior<T>
A ComponentAdapter that realizes a ThreadLocal component instance.
The adapter creates proxy instances, that will create the necessary instances on-the-fly invoking the methods of the
instance. Use this adapter, if you are instantiating your components in a single thread, but should be different when
accessed from different threads. See ThreadLocalizing for details.
Note: Because this implementation uses a Proxy, you can only access the methods exposed by the implemented
interfaces of your component.
- Author:
- Jörg Schaible
- See Also:
- Serialized Form
| Nested classes/interfaces inherited from interface org.picocontainer.ComponentAdapter |
org.picocontainer.ComponentAdapter.NOTHING |
| Fields inherited from class org.picocontainer.behaviors.AbstractBehavior |
delegate |
|
Constructor Summary |
ThreadLocalized(org.picocontainer.ComponentAdapter<T> delegate)
Construct a ThreadLocalized using Proxy instances. |
ThreadLocalized(org.picocontainer.ComponentAdapter<T> delegate,
ProxyFactory proxyFactory)
Construct a ThreadLocalized. |
| Methods inherited from class org.picocontainer.behaviors.AbstractBehavior |
accept, changeMonitor, componentHasLifecycle, currentMonitor, dispose, dispose, findAdapterOfType, getComponentImplementation, getComponentInstance, getComponentKey, getDelegate, hasLifecycle, isStarted, start, start, stop, stop, toString, verify |
ThreadLocalized
public ThreadLocalized(org.picocontainer.ComponentAdapter<T> delegate,
ProxyFactory proxyFactory)
throws org.picocontainer.PicoCompositionException
- Construct a ThreadLocalized.
- Parameters:
delegate - The ComponentAdapter to delegate.proxyFactory - The ProxyFactory to use.
- Throws:
org.picocontainer.PicoCompositionException - Thrown if the component does not implement any interface.
ThreadLocalized
public ThreadLocalized(org.picocontainer.ComponentAdapter<T> delegate)
throws org.picocontainer.PicoCompositionException
- Construct a ThreadLocalized using
Proxy instances.
- Parameters:
delegate - The ComponentAdapter to delegate.
- Throws:
org.picocontainer.PicoCompositionException - Thrown if the component does not implement any interface.
getComponentInstance
public T getComponentInstance(org.picocontainer.PicoContainer pico,
Type into)
throws org.picocontainer.PicoCompositionException
- Specified by:
getComponentInstance in interface org.picocontainer.ComponentAdapter<T>- Overrides:
getComponentInstance in class org.picocontainer.behaviors.AbstractBehavior<T>
- Throws:
org.picocontainer.PicoCompositionException
getDescriptor
public String getDescriptor()
Copyright © 2003-2009 Codehaus. All Rights Reserved.