aboutsummaryrefslogtreecommitdiff
path: root/common/src/main/java/me/lucko/spark/profiler
diff options
context:
space:
mode:
authorLuck <git@lucko.me>2018-05-30 15:02:44 +0100
committerLuck <git@lucko.me>2018-05-30 15:02:44 +0100
commitf7c84b3ced3b079f33517f360414b406658a2a72 (patch)
treeb1f0afafb8468718f3263a1325948fbfc68b38a0 /common/src/main/java/me/lucko/spark/profiler
parenta092e8b1495dc75ff57978985d973185d15e7449 (diff)
downloadspark-f7c84b3ced3b079f33517f360414b406658a2a72.tar.gz
spark-f7c84b3ced3b079f33517f360414b406658a2a72.tar.bz2
spark-f7c84b3ced3b079f33517f360414b406658a2a72.zip
Allow multiple threads to be specified
Diffstat (limited to 'common/src/main/java/me/lucko/spark/profiler')
-rw-r--r--common/src/main/java/me/lucko/spark/profiler/ThreadDumper.java7
1 files changed, 5 insertions, 2 deletions
diff --git a/common/src/main/java/me/lucko/spark/profiler/ThreadDumper.java b/common/src/main/java/me/lucko/spark/profiler/ThreadDumper.java
index 17047fd..9c2e974 100644
--- a/common/src/main/java/me/lucko/spark/profiler/ThreadDumper.java
+++ b/common/src/main/java/me/lucko/spark/profiler/ThreadDumper.java
@@ -20,6 +20,8 @@ package me.lucko.spark.profiler;
import java.lang.management.ThreadInfo;
import java.lang.management.ThreadMXBean;
+import java.util.Set;
+import java.util.stream.Collectors;
/**
* Uses the {@link ThreadMXBean} to generate {@link ThreadInfo} instances for the threads being
@@ -56,9 +58,10 @@ public interface ThreadDumper {
this.ids = ids;
}
- public Specific(String name) {
+ public Specific(Set<String> names) {
+ Set<String> threadNamesLower = names.stream().map(String::toLowerCase).collect(Collectors.toSet());
this.ids = Thread.getAllStackTraces().keySet().stream()
- .filter(t -> t.getName().equalsIgnoreCase(name))
+ .filter(t -> threadNamesLower.contains(t.getName().toLowerCase()))
.mapToLong(Thread::getId)
.toArray();
}