Caching in BufferedAuhtorityFactory does not work
-------------------------------------------------

                 Key: GEOT-907
                 URL: http://jira.codehaus.org/browse/GEOT-907
             Project: GeoTools
          Issue Type: Bug
          Components: core referencing
    Affects Versions: 2.2-RC2
         Environment: Windows XP SP2, JDK 1.5.0_06, JBoss 4.0.4-GA
            Reporter: Felix LJ Mayer
         Assigned To: Martin Desruisseaux


The problem is one line the this method in 
org.geotools.referencing.factory.BufferedAuthorityFactory:

    private void put(final Object key, final Object object) {
        pool.put(key, object);
        // TODO fixed this line
        int toReplace = maxStrongReferences - pool.size(); // here is the 
problem
        if (toReplace > 0) {
            ...
        }
    }

This line should be
        int toReplace = pool.size() - maxStrongReferences;

With the current code, if maxStrongReferences = 100 and pool.size() = 20, up to 
80 entries in the pool will be overwritten with WeakReferences, resulting in 
nearly no caching.

And while you're at it, could you please give
org.geotools.referencing.factory.epsg.DefaultFactory
a constructor that lets me set the buffer size in the BufferedAuthorityFactory?



-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: 
http://jira.codehaus.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

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