On Mon, Nov 5, 2012 at 6:46 AM, Andrea Aime <[email protected]>wrote:
> On Mon, Nov 5, 2012 at 2:40 PM, Justin Deoliveira <[email protected]>
> wrote:
> > Hmmm... nasty :)
> >
> > How about we go with (c) and not remove the listeners, but also add a
> > handleDispose() method to the CatalogListener interface?
>
> And this method would be used... hum... how?
>
> What I think I saw is that the old resource pool gets thrown away, and a
> new one
> gets created, but if we keep a reference to the old listener the old
> resource
> pool won't be garbage collected
>
Just an idea but the thought was that rather than release the reference to
the listener to do cleanup the handleDispose() method could be used if the
listener does need to do cleanup. Probably not needed i guess though.
As for the resource pool being thrown away and recreated.... the way this
happens now is a bit of a side affect so I think worth revisiting. On
catalog reload a new catalog is read from disk (and a new object created in
memory). The creation is what triggers the creation of the new resource
pool and re-registration of the cache clearing listener. Later then the
"sync" method on the old Catalog instance is called, which copies over the
new resource pool and new listener list, which at this point only includes
the cache clearing listener.
So... back to how to fix. I still think not clearing the listener list on
disposal is probably simplest. By doing this though in order to avoid
duplicate listeners we probably want ResourcePool to first remove any
existing listeners. What about adding a method to Catalog to remove
listeners by type. So the resource pool constructor would become:
catalog.removeListener(CacheClearingListener.class);
catalog.addListener(new CacheClearingListener());
Another idea would be to use a special interface to mark listeners as
"Reloadable", meaning they will be re-registered on the global reload
event. And then on disposals the catalog would only remove those listeners.
> Cheers
> Andrea
>
> --
> ==
> Our support, Your Success! Visit http://opensdi.geo-solutions.it 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
>
> -------------------------------------------------------
>
--
Justin Deoliveira
OpenGeo - http://opengeo.org
Enterprise support for open source geospatial.
------------------------------------------------------------------------------
LogMeIn Central: Instant, anywhere, Remote PC access and management.
Stay in control, update software, and manage PCs from one command center
Diagnose problems and improve visibility into emerging IT issues
Automate, monitor and manage. Do more in less time with Central
http://p.sf.net/sfu/logmein12331_d2d
_______________________________________________
Geoserver-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/geoserver-devel