Skip to content

Commit 0e34d4c

Browse files
authored
Merge pull request #19505 from pshipton/debugThreadInfo
Add debug output to testThreadMXBeanProxy
2 parents 5fbb4d7 + 1d25f75 commit 0e34d4c

File tree

1 file changed

+30
-0
lines changed

1 file changed

+30
-0
lines changed

test/functional/JLM_Tests/src/org/openj9/test/java/lang/management/TestManagementFactory.java

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@
3131
import java.lang.management.ClassLoadingMXBean;
3232
import java.lang.management.CompilationMXBean;
3333
import java.lang.management.GarbageCollectorMXBean;
34+
import java.lang.management.LockInfo;
3435
import java.lang.management.ManagementFactory;
3536
import java.lang.management.MemoryMXBean;
3637
import java.lang.management.MemoryManagerMXBean;
@@ -1301,6 +1302,35 @@ public void testThreadMXBeanProxy() {
13011302
ThreadInfo ti2 = ManagementFactory.getThreadMXBean().getThreadInfo(Thread.currentThread().getId());
13021303
logger.debug("ti1 : " + ti1.toString());
13031304
logger.debug("ti2 : " + ti2.toString());
1305+
if (!ti2.equals(ti1)) {
1306+
System.out.println("blockedCount ti1: " + ti1.getBlockedCount() + " ti2: " + ti2.getBlockedCount());
1307+
System.out.println("blockedTime ti1: " + ti1.getBlockedTime() + " ti2: " + ti2.getBlockedTime());
1308+
System.out.println("lockOwnerId ti1: " + ti1.getLockOwnerId() + " ti2: " + ti2.getLockOwnerId());
1309+
System.out.println("waitedCount ti1: " + ti1.getWaitedCount() + " ti2: " + ti2.getWaitedCount());
1310+
System.out.println("waitedTime ti1: " + ti1.getWaitedTime() + " ti2: " + ti2.getWaitedTime());
1311+
System.out.println("inNative ti1: " + ti1.isInNative() + " ti2: " + ti2.isInNative());
1312+
System.out.println("suspended ti1: " + ti1.isSuspended() + " ti2: " + ti2.isSuspended());
1313+
System.out.println("threadName ti1: " + ti1.getThreadName() + " ti2: " + ti2.getThreadName());
1314+
System.out.println("threadState ti1: " + ti1.getThreadState() + " ti2: " + ti2.getThreadState());
1315+
System.out.println("lockName ti1: " + ti1.getLockName() + " ti2: " + ti2.getLockName());
1316+
System.out.println("lockOwnerName ti1: " + ti1.getLockOwnerName() + " ti2: " + ti2.getLockOwnerName());
1317+
LockInfo li1 = ti1.getLockInfo();
1318+
LockInfo li2 = ti2.getLockInfo();
1319+
if (!li2.equals(li1)) {
1320+
System.out.println("lockInfo ti1: " + li1 + " ti2: " + li2);
1321+
}
1322+
StackTraceElement[] st1 = ti1.getStackTrace();
1323+
StackTraceElement[] st2 = ti2.getStackTrace();
1324+
if (!st2.equals(st1)) {
1325+
System.out.println("stackTrace length ti1: " + st1.length + " ti2: " + st2.length);
1326+
if (st1.length == st2.length) {
1327+
for (int i = 0; i < st1.length; i++) {
1328+
System.out.println("ti1: " + st1[i]);
1329+
System.out.println("ti2: " + st2[i]);
1330+
}
1331+
}
1332+
}
1333+
}
13041334
AssertJUnit.assertEquals(ti2, ti1);
13051335

13061336
AssertJUnit.assertEquals(proxy.getThreadInfo(Thread.currentThread().getId(), 2),

0 commit comments

Comments
 (0)