From 211ec7f3a68f9beaad99ea041fe20ba4c1b5a00f Mon Sep 17 00:00:00 2001 From: James Seibel Date: Sat, 25 Feb 2023 10:23:18 -0600 Subject: [PATCH] Hard shutdown the world generator, don't wait --- .../BatchGenerationEnvironment.java | 30 ++++++++++++++----- coreSubProjects | 2 +- 2 files changed, 23 insertions(+), 9 deletions(-) diff --git a/common/src/main/java/com/seibel/lod/common/wrappers/worldGeneration/BatchGenerationEnvironment.java b/common/src/main/java/com/seibel/lod/common/wrappers/worldGeneration/BatchGenerationEnvironment.java index eb81b2d72..177939afa 100644 --- a/common/src/main/java/com/seibel/lod/common/wrappers/worldGeneration/BatchGenerationEnvironment.java +++ b/common/src/main/java/com/seibel/lod/common/wrappers/worldGeneration/BatchGenerationEnvironment.java @@ -505,10 +505,13 @@ public final class BatchGenerationEnvironment extends AbstractBatchGenerationEnv public int getEventCount() { return events.size(); } - + @Override - public void stop(boolean blocking) { - EVENT_LOGGER.info("Batch Chunk Generator shutting down..."); + public void stop(boolean blocking) + { + EVENT_LOGGER.info(BatchGenerationEnvironment.class.getSimpleName()+" shutting down..."); + + EVENT_LOGGER.info("Canceling futures..."); executors.shutdownNow(); Iterator iter = events.iterator(); while (iter.hasNext()) @@ -517,13 +520,24 @@ public final class BatchGenerationEnvironment extends AbstractBatchGenerationEnv event.future.cancel(true); iter.remove(); } - if (blocking) try { - if (!executors.awaitTermination(10, TimeUnit.SECONDS)) { - EVENT_LOGGER.error("Batch Chunk Generator shutdown failed! Ignoring child threads..."); + + EVENT_LOGGER.info("Awaiting termination..."); + if (blocking) + { + try + { + if (!executors.awaitTermination(3, TimeUnit.SECONDS)) + { + EVENT_LOGGER.error("Batch Chunk Generator shutdown failed! Ignoring child threads..."); + } + } + catch (InterruptedException e) + { + EVENT_LOGGER.error("Batch Chunk Generator shutdown failed! Ignoring child threads...", e); } - } catch (InterruptedException e) { - EVENT_LOGGER.error("Batch Chunk Generator shutdown failed! Ignoring child threads...", e); } + + EVENT_LOGGER.info(BatchGenerationEnvironment.class.getSimpleName()+" shutdown complete."); } @Override diff --git a/coreSubProjects b/coreSubProjects index b4ffd65fb..b9edf2ef9 160000 --- a/coreSubProjects +++ b/coreSubProjects @@ -1 +1 @@ -Subproject commit b4ffd65fbc1c6b645b5f4550fb73c9a0e67f7233 +Subproject commit b9edf2ef937cc2440f129daca30f4280ae6a943c