From 0b7e2600ca258d729c9f156c45e38c495a4d3a12 Mon Sep 17 00:00:00 2001 From: Luck Date: Tue, 1 Jan 2019 19:25:03 +0000 Subject: Improve ThreadGrouper by pool regex --- spark-common/src/main/java/me/lucko/spark/sampler/ThreadGrouper.java | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'spark-common/src/main/java/me/lucko/spark/sampler/ThreadGrouper.java') diff --git a/spark-common/src/main/java/me/lucko/spark/sampler/ThreadGrouper.java b/spark-common/src/main/java/me/lucko/spark/sampler/ThreadGrouper.java index 72cd4dc..031d7c1 100644 --- a/spark-common/src/main/java/me/lucko/spark/sampler/ThreadGrouper.java +++ b/spark-common/src/main/java/me/lucko/spark/sampler/ThreadGrouper.java @@ -45,9 +45,12 @@ public interface ThreadGrouper { /** * Implementation of {@link ThreadGrouper} that attempts to group by the name of the pool * the thread originated from. + * + *

The regex pattern used to match pools expects a digit at the end of the thread name, + * separated from the pool name with any of one or more of ' ', '-', or '#'.

*/ ThreadGrouper BY_POOL = new ThreadGrouper() { - private final Pattern pattern = Pattern.compile("^(.*)[-#] ?\\d+$"); + private final Pattern pattern = Pattern.compile("^(.*?)[-# ]+\\d+$"); @Override public String getGroup(String threadName) { -- cgit