Make LayerGroupContainmentCache available only on required services #469
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
LayerGroupContainmentCache
can incur in quite a performance penalty during startup, as it'll get all layer groups and the layers/groups they're linked to.LayerGroupContainmentCache
is a securtity subsystem aid only used by WMS.This patch contributes a no-op implementation or a customized one depending on the value of the
geoserver.security.layergroup-containmentcache
boolean config property, which is set totrue
in the default config'sgeoserver.yml
for thewms
,gwc
, andwebui
services.Additionally, the customized
LayerGroupContainmentCache
implementation avoids re-creating the cache multiple times during startup. The original implementation does it at the class constructor and on aContextRefreshedEvent
event.Now, this event is triggered on any
ApplicationContext
refreshed, which for our spring boot services was being triggered three times: for the app context itself, the servlet context, and the actuator context.Now we make sure the cache is built only when the root application context is refreshed.