< prev index next > test/jdk/com/sun/management/ThreadMXBean/VirtualThreads.java
Print this page
try {
long tid0 = Thread.currentThread().threadId();
long tid1 = vthread.threadId();
long[] tids = new long[] { tid0, tid1 };
long[] allocated = bean.getThreadAllocatedBytes(tids);
- assertTrue(allocated[0] >= 0L);
+ if (Thread.currentThread().isVirtual()) {
+ assertEquals(-1L, allocated[0]);
+ } else {
+ assertTrue(allocated[0] >= 0L);
+ }
assertEquals(-1L, allocated[1]);
} finally {
LockSupport.unpark(vthread);
}
}
try {
long tid0 = Thread.currentThread().threadId();
long tid1 = vthread.threadId();
long[] tids = new long[] { tid0, tid1 };
long[] cpuTimes = bean.getThreadCpuTime(tids);
- assertTrue(cpuTimes[0] >= 0L);
+ if (Thread.currentThread().isVirtual()) {
+ assertEquals(-1L, cpuTimes[0]);
+ } else {
+ assertTrue(cpuTimes[0] >= 0L);
+ }
assertEquals(-1L, cpuTimes[1]);
} finally {
LockSupport.unpark(vthread);
}
}
try {
long tid0 = Thread.currentThread().threadId();
long tid1 = vthread.threadId();
long[] tids = new long[] { tid0, tid1 };
long[] userTimes = bean.getThreadUserTime(tids);
- assertTrue(userTimes[0] >= 0L);
+ if (Thread.currentThread().isVirtual()) {
+ assertEquals(-1L, userTimes[0]);
+ } else {
+ assertTrue(userTimes[0] >= 0L);
+ }
assertEquals(-1L, userTimes[1]);
} finally {
LockSupport.unpark(vthread);
}
}
< prev index next >