8211931-terminatedThrd-jdk Udiff test/hotspot/jtreg/runtime/jni/terminatedThread/TestTerminatedThread.java (original) (raw)
< prev index next >
rev 52057 : 8211931: [ppc] runtime/jni/terminatedThread/TestTerminatedThread.java fails as threads don't terminate immediately
@@ -82,13 +82,31 @@
if (mbean.isThreadCpuTimeSupported() &&
mbean.isThreadCpuTimeEnabled() ) {
System.out.println("Calling getThreadCpuTime ...");
long t1 = mbean.getThreadCpuTime(t.getId());
if (t1 != -1) {
// On ppc, we see the thread time still increasing for a while, until
// the thread actually disappears and our linux::fast_cpu_time() returns -1.
// So give it a few tries.
// Basically, a new thread could get the same tid, but given this test
// we can assume the VM does not start new threads any more.
long t2 = t1;
int retry_count = 60; // 60 tries each taking one second.
while (t2 != -1 && retry_count > 0) {
if (t2 != t1) {
System.out.println("" + retry_count + " ThreadCpuTime still increasing after join: " + t2);
} else {
System.out.println("" + retry_count + " Thread was still around with ThreadCpuTime: " + t1);
}
java.lang.Thread.sleep(1000);
t2 = mbean.getThreadCpuTime(t.getId());
retry_count--;
}
if (t2 != -1) { throw new RuntimeException("Invalid ThreadCpuTime returned = " +
t1 + " expected = -1");
t2 + " expected = -1"); } System.out.println("Okay: getThreadCpuTime() reported -1 as expected"); } else { System.out.println("Skipping Thread CPU time test as it's not supported"); }
< prev index next >