Andrea Aime a écrit :
> I'm wondering if all the synchronized keywords around the
> getXXXFactory methods of CommonFactoryFinder are really needed.
> Wouldn't it be sufficient to syncrhonize the creation of the
> the service registry, that is, the getServiceRegistry?
> Scanning the registry takes quite a bit more time that just
> creating it.

The problem is that the scans of the registry can change the registry state as 
well. The factory are not loaded at FactoryRegistry creation, but delayed until 
a scan is performed for a given category. The state may also change if a 
factory 
iterator were added or removed since the last scan, etc.

However if we implement the cache you are suggesting, we could look in the 
cache 
first in a non-synchronized block (maybe using ConcurrentHashMap or some 
similar 
mechanism), then synchronize only if no suitable factory were found in the 
cache.

        Martin


-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
Geotools-devel mailing list
Geotools-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/geotools-devel

Reply via email to