From f7c84b3ced3b079f33517f360414b406658a2a72 Mon Sep 17 00:00:00 2001 From: Luck Date: Wed, 30 May 2018 15:02:44 +0100 Subject: Allow multiple threads to be specified --- common/src/main/java/me/lucko/spark/profiler/ThreadDumper.java | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'common/src/main/java/me/lucko/spark/profiler') 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 names) { + Set 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(); } -- cgit