diff options
-rw-r--r-- | spark-common/src/main/java/me/lucko/spark/common/SparkPlatform.java | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/spark-common/src/main/java/me/lucko/spark/common/SparkPlatform.java b/spark-common/src/main/java/me/lucko/spark/common/SparkPlatform.java index fc41b6f..ec1ea9a 100644 --- a/spark-common/src/main/java/me/lucko/spark/common/SparkPlatform.java +++ b/spark-common/src/main/java/me/lucko/spark/common/SparkPlatform.java @@ -352,10 +352,12 @@ public class SparkPlatform { // schedule a task to detect timeouts this.plugin.executeAsync(() -> { timeoutThread.set(Thread.currentThread()); + int warningIntervalSeconds = 5; + try { for (int i = 1; i <= 3; i++) { try { - Thread.sleep(5000); + Thread.sleep(warningIntervalSeconds * 1000); } catch (InterruptedException e) { // ignore } @@ -367,7 +369,8 @@ public class SparkPlatform { Thread executor = executorThread.get(); if (executor == null) { getPlugin().log(Level.WARNING, "A command execution has not completed after " + - (i * 5) + " seconds but there is no executor present. Perhaps the executor shutdown?"); + (i * warningIntervalSeconds) + " seconds but there is no executor present. Perhaps the executor shutdown?"); + getPlugin().log(Level.WARNING, "If the command subsequently completes without any errors, this warning should be ignored. :)"); } else { String stackTrace = Arrays.stream(executor.getStackTrace()) @@ -375,7 +378,8 @@ public class SparkPlatform { .collect(Collectors.joining("\n")); getPlugin().log(Level.WARNING, "A command execution has not completed after " + - (i * 5) + " seconds, it might be stuck. Trace: \n" + stackTrace); + (i * warningIntervalSeconds) + " seconds, it *might* be stuck. Trace: \n" + stackTrace); + getPlugin().log(Level.WARNING, "If the command subsequently completes without any errors, this warning should be ignored. :)"); } } } finally { |