What if an iterator needs to be closed early though? Or user code dies
in the middle of an iteration. There is potential for resource leak.

Having a close method makes it more explicit that you should perform the
iteration in a try-finally block, and close the iterator in the finally
close.

As you know the Iterator interface itself doesn't support close, so we
would have to extend the interface to pull it off. There are already
three interfaces for iterating over features, FeatureIterator,
FeatureReader, and Iterator. We could just choose one and stick with it.

Also, the future for feature collection is a bit undecided. We just
recently got some good feedback from Bryce about FeatureCollection being
the composition of a Feature and a Collection, as opposed to an
extension of both. We will undoubetdly have to sort this out when the
new feature model comes on. Until we decide, we may want to hold off on
changing any of the current api.

My 2c

-Justin


Andrea Aime wrote:
> Hi,
> I'd like to propose deprecating and then removing the above
> method. It's error prone and breaks the usual for(Iterator it...)
> idioms. Feature iterators should automatically close themselves
> once they reach the end, it should be as simple as that.
>


> What do you think?
> What's the reason to have that close around, why can't we
> assume FeatureIterator implementors are smart enough to close
> themselves once reached the end, or have the user call close()
> on the iterator if the end is not reached?
> 
> Cheers
> Andrea
> 
> -------------------------------------------------------------------------
> 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
> 
> !DSPAM:1004,4594de75250054750375898!
> 


-- 
Justin Deoliveira
[EMAIL PROTECTED]
The Open Planning Project
http://topp.openplans.org

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