ARTEMIS-4076: make test ThreadLeakCheckRule account for differences on Java 19

In Java 19 the "process reaper" Thread name can change while it is working to also denote the related pid.

Also, the threads are created differently and dont belong to the "system" thread group as before, but the "InnocuousThreadGroup".

Related changes:
9561b5e041
f0282d7def
This commit is contained in:
Robbie Gemmell 2022-10-27 11:53:23 +01:00
parent 9056ac1cc7
commit 69264aee32
1 changed files with 2 additions and 2 deletions

View File

@ -235,7 +235,7 @@ public class ThreadLeakCheckRule extends TestWatcher {
private boolean isExpectedThread(Thread thread) {
final String threadName = thread.getName();
final ThreadGroup group = thread.getThreadGroup();
final boolean isSystemThread = group != null && "system".equals(group.getName());
final boolean isSystemThread = group != null && ("system".equals(group.getName()) || "InnocuousThreadGroup".equals(group.getName()));
final String javaVendor = System.getProperty("java.vendor");
if (threadName.contains("SunPKCS11")) {
@ -244,7 +244,7 @@ public class ThreadLeakCheckRule extends TestWatcher {
return true;
} else if (threadName.contains("Attach Listener")) {
return true;
} else if ((javaVendor.contains("IBM") || isSystemThread) && threadName.equals("process reaper")) {
} else if ((javaVendor.contains("IBM") || isSystemThread) && threadName.startsWith("process reaper")) {
return true;
} else if ((javaVendor.contains("IBM") || isSystemThread) && threadName.equals("ClassCache Reaper")) {
return true;