@Override public boolean containsLayer(String layerName) { checkNotNull(layerName, "layer id is null"); lock.acquireReadLock(); try { if (pendingDeletes.contains(layerName)) { return false; } Set<String> layerNames = tileLayerCatalog.getLayerNames(); boolean hasLayer = layerNames.contains(layerName); return hasLayer; } finally { lock.releaseReadLock(); } }
/** @see TileLayerConfiguration#getLayers() */ @Override public Collection<TileLayer> getLayers() { lock.acquireReadLock(); try { final Set<String> layerNames = tileLayerCatalog.getLayerNames(); Function<String, Optional<TileLayer>> lazyLayerFetch = CatalogConfiguration.this::getLayer; // removing the NULL results // TODO Should deep copy or wrap with modification proxies, // see // org.geoserver.gwc.layer.CatalogConfigurationLayerConformanceTest.testModifyCallRequiredToChangeInfoFromGetInfo() return Lists.newArrayList( layerNames .stream() .map(lazyLayerFetch) .filter(Optional::isPresent) .map(Optional::get) .collect(Collectors.toList())); } finally { lock.releaseReadLock(); } }
lock.readLock().lock(); try { final Set<String> storedNames = tileLayerCatalog.getLayerNames(); Set<String> names = null; if (!pendingDeletes.isEmpty()) {
lock.acquireReadLock(); try { final Set<String> storedNames = tileLayerCatalog.getLayerNames(); Set<String> names = null; if (!pendingDeletes.isEmpty()) {
when(tileLayerCatalog.getLayerIds()).thenReturn( ImmutableSet.of(layer1.getId(), layer2.getId(), group1.getId(), group2.getId())); when(tileLayerCatalog.getLayerNames()).thenReturn(layerNames);