diff options
author | Luck <git@lucko.me> | 2022-07-12 22:37:59 +0100 |
---|---|---|
committer | Luck <git@lucko.me> | 2022-07-12 22:37:59 +0100 |
commit | 73dd214ae66bab483ee8b4f0ed03881466da92e8 (patch) | |
tree | 11b433c6b9b15e75249732248c150c35af08c24f /spark-sponge7/src/main/java/me/lucko/spark/sponge | |
parent | a10f966a443d56845a5efb1e65232e6b87eabb96 (diff) | |
download | spark-73dd214ae66bab483ee8b4f0ed03881466da92e8.tar.gz spark-73dd214ae66bab483ee8b4f0ed03881466da92e8.tar.bz2 spark-73dd214ae66bab483ee8b4f0ed03881466da92e8.zip |
Improve/fix game thread dumper
Diffstat (limited to 'spark-sponge7/src/main/java/me/lucko/spark/sponge')
-rw-r--r-- | spark-sponge7/src/main/java/me/lucko/spark/sponge/Sponge7SparkPlugin.java | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/spark-sponge7/src/main/java/me/lucko/spark/sponge/Sponge7SparkPlugin.java b/spark-sponge7/src/main/java/me/lucko/spark/sponge/Sponge7SparkPlugin.java index 324e242..e6c9a04 100644 --- a/spark-sponge7/src/main/java/me/lucko/spark/sponge/Sponge7SparkPlugin.java +++ b/spark-sponge7/src/main/java/me/lucko/spark/sponge/Sponge7SparkPlugin.java @@ -73,9 +73,9 @@ public class Sponge7SparkPlugin implements SparkPlugin { private final Path configDirectory; private final SpongeExecutorService asyncExecutor; private final SpongeExecutorService syncExecutor; + private final ThreadDumper.GameThread gameThreadDumper = new ThreadDumper.GameThread(); private SparkPlatform platform; - private final ThreadDumper.GameThread threadDumper = new ThreadDumper.GameThread(); @Inject public Sponge7SparkPlugin(PluginContainer pluginContainer, Logger logger, Game game, @ConfigDir(sharedRoot = false) Path configDirectory, @AsynchronousExecutor SpongeExecutorService asyncExecutor, @SynchronousExecutor SpongeExecutorService syncExecutor) { @@ -85,6 +85,8 @@ public class Sponge7SparkPlugin implements SparkPlugin { this.configDirectory = configDirectory; this.asyncExecutor = asyncExecutor; this.syncExecutor = syncExecutor; + + this.syncExecutor.execute(() -> this.gameThreadDumper.setThread(Thread.currentThread())); } @Listener @@ -151,7 +153,7 @@ public class Sponge7SparkPlugin implements SparkPlugin { @Override public ThreadDumper getDefaultThreadDumper() { - return this.threadDumper.get(); + return this.gameThreadDumper.get(); } @Override @@ -201,7 +203,6 @@ public class Sponge7SparkPlugin implements SparkPlugin { @Override public CommandResult process(CommandSource source, String arguments) { - this.plugin.threadDumper.ensureSetup(); this.plugin.platform.executeCommand(new Sponge7CommandSender(source), arguments.split(" ")); return CommandResult.empty(); } |