I am for it Andrea, a quick question - we did try and implement a close
method previously to prep for Java 7 try-with-resource. Did they change the
interface name on us - or am I missing something?
-
http://docs.codehaus.org/display/GEOTOOLS/Java+7+try-with-resource+compatibility
In generally we should ensure all our "closable" things can work with
try-with-resource. If we can do that in a consistent fashion all the better.
Looks like AutoClosable has slight different meaning:* Note that unlike the
close method of Closeable, this close method is not required to be
idempotent. In other words, calling this close method more than once may
have some visible side effect, unlike Closeable.close which is required to
have no effect if called more than once. However, implementers of this
interface are strongly encouraged to make their close methods idempotent.*
So my understanding is Closable extends AutoClosable in order to explicitly
throws an IOException (thus being obvious that data access is occurring).
So yeah choose the appropriate interface and lets ensure we work with
try-with-resource. For GridCoverageReader I expect Closable may be
appropriate.
Jody
Jody Garnett
On Mon, Jun 30, 2014 at 8:10 PM, Andrea Aime <[email protected]>
wrote:
> Hi,
> I'm wondering if it would be good to have GridCoverageReader implement
> AutoCloseable, so that it can be used in "try with resources", e.g.:
>
> try(GridCoverageReaader reader = new GeotiffReader(myFile)) {
> ...
> }
>
> The annoyance is that GridCoverageReader exposes a dispose() method,
> instead of a close() one.
> I guess it would not hurt to have both, and/or deprecate dispose in the
> process?
>
> Also wondering if the same treatment should be applied to other interfaces
> (e.g., DataAccess)
>
> Anyways... just thinking out loud here, I don't have a mandate to work in
> this
> direction, just wondering.
>
> Cheers
> Andrea
>
> --
> ==
> GeoServer Professional Services from the experts! Visit
> http://goo.gl/NWWaa2 for more information.
> ==
>
> Ing. Andrea Aime
> @geowolf
> Technical Lead
>
> GeoSolutions S.A.S.
> Via Poggio alle Viti 1187
> 55054 Massarosa (LU)
> Italy
> phone: +39 0584 962313
> fax: +39 0584 1660272
> mob: +39 339 8844549
>
> http://www.geo-solutions.it
> http://twitter.com/geosolutions_it
>
> -------------------------------------------------------
>
>
> ------------------------------------------------------------------------------
> Open source business process management suite built on Java and Eclipse
> Turn processes into business applications with Bonita BPM Community Edition
> Quickly connect people, data, and systems into organized workflows
> Winner of BOSSIE, CODIE, OW2 and Gartner awards
> http://p.sf.net/sfu/Bonitasoft
> _______________________________________________
> GeoTools-Devel mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/geotools-devel
>
>
------------------------------------------------------------------------------
Open source business process management suite built on Java and Eclipse
Turn processes into business applications with Bonita BPM Community Edition
Quickly connect people, data, and systems into organized workflows
Winner of BOSSIE, CODIE, OW2 and Gartner awards
http://p.sf.net/sfu/Bonitasoft
_______________________________________________
GeoTools-Devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/geotools-devel