handle interruptedexception correctly

This commit is contained in:
okx-code
2025-08-19 03:17:22 +01:00
parent 654c598e60
commit c6983c9dce

View File

@@ -34,13 +34,17 @@ public class ChunkMetaListener implements Listener {
this.viewTracker = viewTracker;
this.unloadQueue = new LinkedBlockingQueue<>();
unloadConsumer = new Thread(() -> {
while (true) {
try {
Chunk chunk = unloadQueue.take();
manager.unloadChunkData(chunk);
} catch (RuntimeException | InterruptedException e) {
CHUNK_META_LOGGER.warn("Handling chunk unloads", e);
try {
while (true) {
try {
Chunk chunk = unloadQueue.take();
manager.unloadChunkData(chunk);
} catch (RuntimeException e) {
CHUNK_META_LOGGER.warn("Handling chunk unloads", e);
}
}
} catch (InterruptedException e) {
Thread.currentThread().interrupt();
}
}, "CivModCore chunk unload handler");
unloadConsumer.start();