|
31 | 31 | import java.lang.management.ClassLoadingMXBean;
|
32 | 32 | import java.lang.management.CompilationMXBean;
|
33 | 33 | import java.lang.management.GarbageCollectorMXBean;
|
| 34 | +import java.lang.management.LockInfo; |
34 | 35 | import java.lang.management.ManagementFactory;
|
35 | 36 | import java.lang.management.MemoryMXBean;
|
36 | 37 | import java.lang.management.MemoryManagerMXBean;
|
@@ -1301,6 +1302,35 @@ public void testThreadMXBeanProxy() {
|
1301 | 1302 | ThreadInfo ti2 = ManagementFactory.getThreadMXBean().getThreadInfo(Thread.currentThread().getId());
|
1302 | 1303 | logger.debug("ti1 : " + ti1.toString());
|
1303 | 1304 | 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 | + } |
1304 | 1334 | AssertJUnit.assertEquals(ti2, ti1);
|
1305 | 1335 |
|
1306 | 1336 | AssertJUnit.assertEquals(proxy.getThreadInfo(Thread.currentThread().getId(), 2),
|
|
0 commit comments