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-common/src/main/java/me | |
parent | a10f966a443d56845a5efb1e65232e6b87eabb96 (diff) | |
download | spark-73dd214ae66bab483ee8b4f0ed03881466da92e8.tar.gz spark-73dd214ae66bab483ee8b4f0ed03881466da92e8.tar.bz2 spark-73dd214ae66bab483ee8b4f0ed03881466da92e8.zip |
Improve/fix game thread dumper
Diffstat (limited to 'spark-common/src/main/java/me')
-rw-r--r-- | spark-common/src/main/java/me/lucko/spark/common/sampler/ThreadDumper.java | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/spark-common/src/main/java/me/lucko/spark/common/sampler/ThreadDumper.java b/spark-common/src/main/java/me/lucko/spark/common/sampler/ThreadDumper.java index 9d54f50..fe3a6a7 100644 --- a/spark-common/src/main/java/me/lucko/spark/common/sampler/ThreadDumper.java +++ b/spark-common/src/main/java/me/lucko/spark/common/sampler/ThreadDumper.java @@ -83,10 +83,8 @@ public interface ThreadDumper { return Objects.requireNonNull(this.dumper, "dumper"); } - public void ensureSetup() { - if (this.dumper == null) { - this.dumper = new Specific(new long[]{Thread.currentThread().getId()}); - } + public void setThread(Thread thread) { + this.dumper = new Specific(new long[]{thread.getId()}); } } @@ -98,6 +96,10 @@ public interface ThreadDumper { private Set<Thread> threads; private Set<String> threadNamesLowerCase; + public Specific(Thread thread) { + this.ids = new long[]{thread.getId()}; + } + public Specific(long[] ids) { this.ids = ids; } |