org.picocontainer.gems.adapters
Class ThreadLocalComponentAdapter
java.lang.Object
org.picocontainer.defaults.DecoratingComponentAdapter
org.picocontainer.gems.adapters.ThreadLocalComponentAdapter
- All Implemented Interfaces:
- Serializable, ComponentAdapter, ComponentMonitorStrategy, LifecycleStrategy, LifecycleManager
public class ThreadLocalComponentAdapter
- extends DecoratingComponentAdapter
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 ThreadLocalComponentAdapterFactory
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
Methods inherited from class org.picocontainer.defaults.DecoratingComponentAdapter |
accept, changeMonitor, currentMonitor, dispose, dispose, getComponentImplementation, getComponentKey, getDelegate, hasLifecycle, hasLifecycle, start, start, stop, stop, toString, verify |
ThreadLocalComponentAdapter
public ThreadLocalComponentAdapter(ComponentAdapter delegate,
ProxyFactory proxyFactory)
throws PicoIntrospectionException
- Construct a ThreadLocalComponentAdapter.
- Parameters:
delegate
- The ComponentAdapter
to delegate.proxyFactory
- The ProxyFactory
to use.
- Throws:
PicoIntrospectionException
- Thrown if the component does not implement any interface.
ThreadLocalComponentAdapter
public ThreadLocalComponentAdapter(ComponentAdapter delegate)
throws PicoIntrospectionException
- Construct a ThreadLocalComponentAdapter using
Proxy
instances.
- Parameters:
delegate
- The ComponentAdapter
to delegate.
- Throws:
PicoIntrospectionException
- Thrown if the component does not implement any interface.
getComponentInstance
public Object getComponentInstance(PicoContainer pico)
throws PicoInitializationException,
PicoIntrospectionException,
AssignabilityRegistrationException,
NotConcreteRegistrationException
- Specified by:
getComponentInstance
in interface ComponentAdapter
- Overrides:
getComponentInstance
in class DecoratingComponentAdapter
- Throws:
PicoInitializationException
PicoIntrospectionException
AssignabilityRegistrationException
NotConcreteRegistrationException
Copyright © 2003-2010 Codehaus. All Rights Reserved.