mirror of
https://github.com/Winds-Studio/Leaf.git
synced 2025-12-26 10:29:13 +00:00
fix shutdown
This commit is contained in:
@@ -15,15 +15,6 @@ public class ShutdownExecutors {
|
||||
public static final Logger LOGGER = LogManager.getLogger("Leaf");
|
||||
|
||||
public static void shutdown(MinecraftServer server) {
|
||||
if (AsyncLocator.LOCATING_EXECUTOR_SERVICE != null) {
|
||||
LOGGER.info("Waiting for structure locating executor to shutdown...");
|
||||
AsyncLocator.LOCATING_EXECUTOR_SERVICE.shutdown();
|
||||
try {
|
||||
AsyncLocator.LOCATING_EXECUTOR_SERVICE.awaitTermination(60L, TimeUnit.SECONDS);
|
||||
} catch (InterruptedException ignored) {
|
||||
}
|
||||
}
|
||||
|
||||
if (server.mobSpawnExecutor != null && server.mobSpawnExecutor.thread.isAlive()) {
|
||||
LOGGER.info("Waiting for mob spawning thread to shutdown...");
|
||||
try {
|
||||
@@ -67,5 +58,14 @@ public class ShutdownExecutors {
|
||||
} catch (InterruptedException ignored) {
|
||||
}
|
||||
}
|
||||
|
||||
if (AsyncLocator.LOCATING_EXECUTOR_SERVICE != null) {
|
||||
LOGGER.info("Waiting for structure locating executor to shutdown...");
|
||||
AsyncLocator.LOCATING_EXECUTOR_SERVICE.shutdown();
|
||||
try {
|
||||
AsyncLocator.LOCATING_EXECUTOR_SERVICE.awaitTermination(60L, TimeUnit.SECONDS);
|
||||
} catch (InterruptedException ignored) {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -46,10 +46,9 @@ public class AsyncLocator {
|
||||
}
|
||||
|
||||
static {
|
||||
int threads = org.dreeam.leaf.config.modules.async.AsyncLocator.asyncLocatorThreads;
|
||||
LOCATING_EXECUTOR_SERVICE = new ThreadPoolExecutor(
|
||||
LOCATING_EXECUTOR_SERVICE = !org.dreeam.leaf.config.modules.async.AsyncLocator.enabled ? null : new ThreadPoolExecutor(
|
||||
1,
|
||||
threads,
|
||||
org.dreeam.leaf.config.modules.async.AsyncLocator.asyncLocatorThreads,
|
||||
org.dreeam.leaf.config.modules.async.AsyncLocator.asyncLocatorKeepalive,
|
||||
TimeUnit.SECONDS,
|
||||
new LinkedBlockingQueue<>(),
|
||||
|
||||
Reference in New Issue
Block a user