On 14/06/2010, at 4:52 PM, Andrea Aime wrote: > Jody Garnett ha scritto: >>> Please don't add a layer.dispose() method, resources to be disposed >>> are harder to use so let's limit the usage of dispose/close methods >>> to cases where it's really necessary to do so (file, streams, >>> database connections and so on). Swing does not have a "dispose()" >>> method for components despites handling lots of listeners, so >>> there's something to learn there I guess (worst case we can just >>> have the listeners be dropped in the finalizer?). >> I remember what you were saying about Swing using weak references for >> its listeners; currently I am using the CopyOnWriteArrayList >> implementations. I will move the clean up code to a dispose method >> and see how we go. > > Which is basically like saying: "I remember what you said but I did > not look into it, and I'm also ignoring what you said above too, > and adding dispose methods all around". > If you think my suggestion is bad at least say so directly > (and explain why).
The choice of CopyOnWriteArray was intensional for thread safety; I may try and make the contents of the CopyOnWriteArray into weak references however; your suggestion is not bad I just have not gotten to it yet. >> Do we expect them to clean up after the GridCoverage readers? If so >> how ... > > A map context that closes readers might be problematic, what if the > underlying application caches the readers? Hum, it's a connection pool > like situation, I guess we would have to wrap them so that the close > method does nothing (and kiss goodbye the ability to recognize their actual > type by instanceof... ). Can I ask if GeoServer catalog maintains grid coverage readers right now? It is not something we have added to the GeoTools registery; and I am not sure if it is part of the contract if a GridCoverage reader needs to be clean up or not? I am content to accept that the cleaning up of a renderer is the responsibility of the application and we should not complicate the MapContext by giving it responsibilities for managing data. I will report back with a new email thread once the topics covered here are tied up in a patch. Jody ------------------------------------------------------------------------------ ThinkGeek and WIRED's GeekDad team up for the Ultimate GeekDad Father's Day Giveaway. ONE MASSIVE PRIZE to the lucky parental unit. See the prize list and enter to win: http://p.sf.net/sfu/thinkgeek-promo _______________________________________________ Geotools-devel mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/geotools-devel
