RE: Re: [picocontainer-dev] Pico2: ASM ImplementationHiding ComponentAdapter

Jörg Schaible <[email protected]>
Newsgroups gmane.comp.java.picocontainer.devel
Message-ID <[email protected]>
Jörg Schaible wrote on Monday, May 14, 2007 11:00 PM:

> Paul Hammant wrote:
> 
>> HSCA is caching implicitly. So I've no need to wrap with CachingCAF.
>> 
>> Maybe CA should optionally extend a new Caching interface.  That may
>> be marker-esque (bad) unless we add a flush() method.
>> 
>> Though if it is as you say I can do:
>> 
>>    CA ca = pico.getComponentAdapter(MyClass.class).getDelegate();
>>    Object ldInstance = ca.swapRealInstance(newInstance)
>> 
>> Well, it would involve some casts to get it to compile :-)
> 
> Well, CachingCA was only an example. Maybe you should have a look at
> the EJBClientCA for more complex real-life scenarios.

You're right the EJBCA was not the right example. Scenario was:

pico.registerComponent(new CachingCA(new HSCA(new CICA(A.class))));

vs.

pico.registerComponent(new HSCA(new CachingCA(new CICA(A.class))));


With the first expression, you can exchange the A instance globally, while in the second scenario you can exchange a global default instance of A for a specific component. Therefore I don't like a combination of caching and HS. ANd consider that 

pico.registerComponent(new ThreadLocalCA(new HSCA(new CICA(A.class))));

vs.

pico.registerComponent(new HSCA(new ThreadLocalCA(new CICA(A.class))));

makes perfectly sence. Still need the HS functionality, but caching is completely different (or replace ThreadLocalCA with PooledCA).

- Jörg



> 
> - Jörg
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe from this list please visit:
> 
>     http://xircles.codehaus.org/manage_email

---------------------------------------------------------------------
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.