diff options
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; } |