Jody Garnett ha scritto: > 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?
Yes, GeoServer caches them, opening them is expensive. And yes, they need to be cleaned up too, the GS resource pool does that as well when the LRU cache in the resource pool is about to drop one of them off. Not sure about the GT2 registry... is anyone using it at all? Cheers Andrea -- Andrea Aime OpenGeo - http://opengeo.org Expert service straight from the developers. ------------------------------------------------------------------------------ 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
