Jody Garnett a écrit :
> This is an amazing example of being lazy - the Set is returned - and 
> each call to iterator() will produce a result set ... (no word on 
> leaking results set when normal people call "Object sample = 
> authorityCodes.iterator().next()";

We rely on finalize() for closing the result set.


> Letting these AuthorityCodes sets escape out into the wild world of user 
> code would prove fatal for me - since the connection could be reclaimed 
> at any time (indeed I suspect that they would break in the existing 
> implementation when the connection is reclaimed at the twenty minuet mark?).

It should not break since DirectEpsgFactory.canDispose() prevents the 
connection 
to be reclaimed as long as at least one AuthorityCodes still alive in the wild 
world.


> Regardless I need to figure out how I can be greedy - and aquire all the 
> authority codes on set creation :-(

I would like to avoid acquirying any authority codes before needed. I would 
like 
to support use cases like the following one:

   factory.getAuthorityCodes(CoordinateReferenceSystem.class).contains("4326");

where the Set.contains("4326") method call maps directly to "SELECT name FROM 
CoordinateReferenceSystems WHERE ID=4326". It allows us to take advantage of 
database index without loading the full set of EPSG codes.

We may try something along the line of your third proposal: hold the DataSource 
and use it when needed.

        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

Reply via email to