Skip to content

Commit d940475

Browse files
committed
Checking shutdown state also in blob finding.
1 parent 9a2381e commit d940475

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

geowebcache/azureblob/src/main/java/org/geowebcache/azure/AzureBlobStore.java

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -209,14 +209,18 @@ public boolean delete(TileRange tileRange) throws StorageException {
209209
/** Splits the deletion in parts to avoid memory accumulation. */
210210
private Stream<List<BlobItem>> findTileBlobsToDelete(TileRange tileRange, String coordsPrefix) {
211211

212-
Iterable<List<BlobItem>> iterable = () -> new Iterator<>() {
212+
Iterable<List<BlobItem>> blobsIterable = () -> new Iterator<>() {
213213
private final int zoomStart = tileRange.getZoomStart();
214214
private final int zoomStop = tileRange.getZoomStop();
215215
private int currentZoom = zoomStart;
216216
private Iterator<BlobItem> currentBlobIterator = Collections.emptyIterator();
217217

218218
@Override
219219
public boolean hasNext() {
220+
if(shutDown) {
221+
return false;
222+
}
223+
220224
while (!currentBlobIterator.hasNext() && currentZoom <= zoomStop) {
221225
String zoomPrefix = coordsPrefix + "/" + currentZoom;
222226

@@ -253,7 +257,7 @@ public List<BlobItem> next() {
253257
}
254258
};
255259

256-
return StreamSupport.stream(iterable.spliterator(), false);
260+
return StreamSupport.stream(blobsIterable.spliterator(), false);
257261
}
258262

259263
private boolean isTileBlobInBounds(BlobItem tileBlob, long[] bounds) {

0 commit comments

Comments
 (0)