[Geoserver-devel] GeoServerTileLayer (integrated GWC) getting out of synch with catalog

Hi,
while working on a fix for http://jira.codehaus.org/browse/GEOS-4760
I’ve noticed that not all changes I was making to the UI were reflected
in the layer behavior.

After looking a bit into it I’ve noticed this is happening because GeoServerTileLayer keeps a hard reference to LayerInfo and LayerGroupInfo,
which is a big no no: you only get an old snapshot of it, and the first time you access some field, the ModificationProxy around it will cache it and keep on returning that particular value.

Which of course, does not really work well if people are changing, say, caching headers configs.

I’d like to avoid the overhead of a full lookup by name every time, so I guess the quickest thing to do is to cache in GeoServerTileLayer the unique id of the layer or layer group, and access catalog with it when LayerInfo or LayerGroupInfo are needed.
I’ve checked the contents of DefaultCatalogFacade… that still makes it go though a full scan…

A possible alternative is to have each GeoServerTileLayer be a listener onto catalog changes, however in a system with many layers that would make for an awful lot of similar listeners, each interested to their own particular layer.
Do you know if there is way to build just a single centralized listeners, that then locates the corresponding GeoServerTileLayer and updates its cached LayerInfo/LayerGroupInfo?

Cheers
Andrea

==
GeoServer training in Milan, 6th & 7th June 2013! Visit http://geoserver.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


On Mon, Jun 3, 2013 at 8:03 PM, Andrea Aime <andrea.aime@anonymised.com>wrote:

Do you know if there is way to build just a single centralized listeners,
that then locates the corresponding GeoServerTileLayer and updates its
cached LayerInfo/LayerGroupInfo?

Found it, and also found another bug in the process. Made a pull request
that fixes them both, and also avoids spreading the same two strings all
over the code base in the process:
https://github.com/geoserver/geoserver/pull/247

Cheers
Andrea

--

GeoServer training in Milan, 6th & 7th June 2013! Visit
http://geoserver.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

-------------------------------------------------------