From d52323ff4482684fcf3b9ccb12c6d9e4f1a7df0f Mon Sep 17 00:00:00 2001 From: James Seibel Date: Sat, 13 Jan 2024 21:54:11 -0600 Subject: [PATCH] Hide AbstractDataSourceHandler shutdown errors --- .../core/file/AbstractDataSourceHandler.java | 27 ++++++++++--------- 1 file changed, 15 insertions(+), 12 deletions(-) diff --git a/core/src/main/java/com/seibel/distanthorizons/core/file/AbstractDataSourceHandler.java b/core/src/main/java/com/seibel/distanthorizons/core/file/AbstractDataSourceHandler.java index 7333b4228..377061269 100644 --- a/core/src/main/java/com/seibel/distanthorizons/core/file/AbstractDataSourceHandler.java +++ b/core/src/main/java/com/seibel/distanthorizons/core/file/AbstractDataSourceHandler.java @@ -195,19 +195,22 @@ public abstract class AbstractDataSourceHandler + try { - DhSectionPos chunkSectionPos = chunkDataView.getSectionPos(); - LodUtil.assertTrue(chunkSectionPos.overlapsExactly(pos), "Update failed, chunk [" + chunkSectionPos + "] does not overlap section [" + pos + "]."); - - // update this pos - this.updateDataSourceAtPos(pos, chunkDataView); - - // recursively update the parent pos - DhSectionPos parentPos = pos.getParentPos(); - this.recursivelyUpdateDataSourcesAsync(parentPos, chunkDataView); - - }); + executor.execute(() -> + { + DhSectionPos chunkSectionPos = chunkDataView.getSectionPos(); + LodUtil.assertTrue(chunkSectionPos.overlapsExactly(pos), "Update failed, chunk [" + chunkSectionPos + "] does not overlap section [" + pos + "]."); + + // update this pos + this.updateDataSourceAtPos(pos, chunkDataView); + + // recursively update the parent pos + DhSectionPos parentPos = pos.getParentPos(); + this.recursivelyUpdateDataSourcesAsync(parentPos, chunkDataView); + }); + } + catch (RejectedExecutionException ignore) { /* can happen if the executor was shutdown while this task was queued */ } } protected void updateDataSourceAtPos(DhSectionPos pos, ChunkSizedFullDataAccessor chunkData) {