geoserver / geoserver-cloud

Cloud Native GeoServer is GeoServer ready to use in the cloud through dockerized microservices.
http://geoserver.org/geoserver-cloud
Other
245 stars 74 forks source link

Disable catalog and config caching facades during maintenance operations. #437

Closed groldan closed 6 months ago

groldan commented 6 months ago

CachingCatalogFacade and CachingGeoServerFacade initialization and life cycle handler, to enable caching during normal operation and disable it during maintenance operations such as configuration initialization and reloading.

Some methods in the caching decorators may cache null return values (for instance, CachingGeoServerFacade#getService(Class) and others), which is very valuable during normal GeoServer operation as such methods may be called several times per request.

Yet, it can be inconvenient during catalog and config maintenance operations, when, for example, a GeoServerLoader checks for the existence of default or required objects. If a cached null value is returned, multiple GeoServer instances may attempt to create the same default objects (like for ServiceInfos).

For that reason, this GeoServerReinitializer and GeoServerLifecycleHandler listener disables caching before configuration operations on beforeReinitialize() beforeReload(), and enables caching afterwards at initialize(GeoServer) and onReload().