After more though and a quick look in to code for refreshing my memory, there is
whats look like my preference at this time:
ReferencingObjectPool
---------------------
Maybe we should write a generic "ObjectPool" (or "Cache") class instead and put
in into org.geotools.util package. The current "BufferedAuthorityFactory.pool"
and "BufferedAuthorityFactory.findPool" fields would be two distinct instances
of "ObjectPool".
FactoryUsingSQL
---------------
If we can rely on PreparedStatement pooling either through a JDBC 3.0 compliant
DataSource or through a DBCP wrapper, then we could try to remove the Connection
and PreparedStatement cache from FactoryUsingSQL. Together with the replacement
of all other HashMap caches by the above-cited generic ObjectPool cache (except
maybe 'safetyGuard' that we could wrap in a ThreadLocal), it may allow us to:
* Remove most "synchronized" statements, except maybe in createObject(...)
but I guess that 90% of usage would be createCoordinateReferenceSystem(...)
instead.
* Remove the TimerTask used for closing connection in DeferedAuthorityFactory
(or maybe we would keep it for other kind of factory, like the ones backed
by property files...)
* Remove the shutdown hook in DefaultFactory.
Relationship between FactoryUsingSQL and BufferedAuthorityFactory
-----------------------------------------------------------------
It has been suggested to replace this relationship by FactoryUsingSQL holding a
reference to ObjectPool. They are no technical reason for that as far as I know;
the only purpose is that current relationship is considered confusing.
Note that injecting a ObjectPool cache in FactoryUsingSQL essentially transform
FactoryUsingSQL into a BufferedFactoryUsingSQL, which may be seen as someting
against the "separation of concern" principle - wrapping that into a
BufferedAuthorityFactory would become close to useless. But on the other hand,
FactoryUsingSQL is already using a number of other HashMap as caches.
Martin
-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
Geotools-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/geotools-devel