Le mardi 16 janvier 2007 à 10:24 -0800, Jody Garnett a écrit :
> > Is there any reason why the utility class we use ( FactoryFinder,
> > CommonFactoryFinder, etc... ) shouldn't cache all factory lookups? The
> > only argument I could make is that this would not allow us to be
> > dynamic. However I don't think anyone really has this requirement, and
> > if they do they probably are not using the factorySpi mechanism as their
> > plugin method. Thinking of eclipse and spring.

There is two kind of FactoryFinder. The old, deprecated one, which does
a full class scan everytime a method is invoked. And the new ones built
on top of FactoryRegistry (e.g. FactoryFinder in "referencing" and
"coverage" package). Those later FactoryFinder do cache the factories.

I never upgrated the FactoryFinder outside the "coverage" and
"referencing" modules mostly because I was scared to break existing
code. If we accept this risk, I may volunter for upgrating some of them
and see what happen.

There is also an other reason: some peoples wish constructor injection.
FactoryFinder would then be a mechanism for providing default values
when no explicit instance is given to the class constructor. The client
code need to store the factory reference in its fields once for ever at
construction time, so it is already acting as a cache.

    Martin



-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys - and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
Geotools-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/geotools-devel

Reply via email to