Re: [picocontainer-dev] Threaded Caching

Jörg Schaible <[email protected]>
Newsgroups gmane.comp.java.picocontainer.devel
Message-ID <[email protected]>
Paul Hammant wrote:

> Yeah we do.  Now named ThreadLocalizing/ThreadLocalized.
> 
> Is it quite what we want ?  Why does it use ProxyToys Jörg ?

Why does it use a proxy?

See the javadocs ;-)

ThreadLocalizing has two operation modes:

1/ Transparent ThreadLocality: If you have a dependency on a component that
must use an own instance for each thread, you can use a ThreadLocalized
one. In effect you always receive the same object out of the factory
(because it is a proxy), but internally each thread uses its own instance.
This is completely transparent for all other components using it. They do
not even know about this ThreadLocal behavior and treat it as normal
singleton. I used this heavily for EJB clients dealing with multiple
threads.

2/ Distinct ThreadLocality: The factory will create for each thread a new
object i.e. *you* should not use the returned object in different threads.
This is the standard case for requests in a web app. Here the
implementation does not use any proxy.

The proxy in case 1 can be generated either by JDK or CGLIB (which in turn
allows proxying of real objects). This is done by the proxy factory of
PTOYS (remember, Aslak moved all the proxy stuff out of pico into PToys).

- Jörg


---------------------------------------------------------------------
To unsubscribe from this list please visit:

    http://xircles.codehaus.org/manage_email
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.