org.picocontainer.gems.adapters
Class ThreadLocalComponentAdapter
java.lang.Object
org.picocontainer.defaults.DecoratingComponentAdapter
org.picocontainer.gems.adapters.ThreadLocalComponentAdapter
- All Implemented Interfaces:
- org.picocontainer.ComponentAdapter, org.picocontainer.defaults.ComponentMonitorStrategy, org.picocontainer.LifecycleManager, org.picocontainer.defaults.LifecycleStrategy, Serializable
- public class ThreadLocalComponentAdapter
- extends org.picocontainer.defaults.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(org.picocontainer.ComponentAdapter delegate,
ProxyFactory proxyFactory)
throws org.picocontainer.PicoIntrospectionException
- Construct a ThreadLocalComponentAdapter.
- Parameters:
delegate
- The ComponentAdapter
to delegate.proxyFactory
- The ProxyFactory
to use.
- Throws:
org.picocontainer.PicoIntrospectionException
- Thrown if the component does not implement any interface.
ThreadLocalComponentAdapter
public ThreadLocalComponentAdapter(org.picocontainer.ComponentAdapter delegate)
throws org.picocontainer.PicoIntrospectionException
- Construct a ThreadLocalComponentAdapter using
Proxy
instances.
- Parameters:
delegate
- The ComponentAdapter
to delegate.
- Throws:
org.picocontainer.PicoIntrospectionException
- Thrown if the component does not implement any interface.
getComponentInstance
public Object getComponentInstance(org.picocontainer.PicoContainer pico)
throws org.picocontainer.PicoInitializationException,
org.picocontainer.PicoIntrospectionException,
org.picocontainer.defaults.AssignabilityRegistrationException,
org.picocontainer.defaults.NotConcreteRegistrationException
- Throws:
org.picocontainer.PicoInitializationException
org.picocontainer.PicoIntrospectionException
org.picocontainer.defaults.AssignabilityRegistrationException
org.picocontainer.defaults.NotConcreteRegistrationException
Copyright © 2003-2007 Codehaus. All Rights Reserved.