aboutsummaryrefslogtreecommitdiff
path: root/spark-common/src/main/java/me
diff options
context:
space:
mode:
authorLuck <git@lucko.me>2022-07-12 22:37:59 +0100
committerLuck <git@lucko.me>2022-07-12 22:37:59 +0100
commit73dd214ae66bab483ee8b4f0ed03881466da92e8 (patch)
tree11b433c6b9b15e75249732248c150c35af08c24f /spark-common/src/main/java/me
parenta10f966a443d56845a5efb1e65232e6b87eabb96 (diff)
downloadspark-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.java10
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;
}