RE: [picocontainer-dev] [pico2] CachingBehavior + multiple instances..

Jörg Schaible <[email protected]>
Newsgroups gmane.comp.java.picocontainer.devel
Message-ID <[email protected]>
Paul Hammant wrote on Thursday, June 21, 2007 7:24 PM:

> (Pete and I were pairing over beer last night)
> 
> The issue is that in Pico2, CachingBehaviorFactory delegates to
> SyncrohizedBehaviorFactory delegates to ConstuctorInjectionFactory
> which is wrong cos SyncrohizedBehaviorFactory should be frontmost to
> prevent cache problems. 
> 
> The question is, should CachingBehaviorFactory be synchronized
> itself , or is there a situation you'd use caching w/o synchronized
> or vice versa? 
> 
> Say more on ReentrantReadWriteLock ... I've not used it.

Me neither, but it is exaclty what we should use ;-)

Recap: The only reason for the SychronizedCAF was to avoid the overhead of synchronization for every lookup. Doug Lea's concurrent stuff address such situations providing a minimal overhead for reading and safety for writing. That's what can be used now directly in the new CachingCF, no need for an explicit synchronization CF anymore. See example in javadoc of ReentrantReadWriteLock.

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