/** *StartsupthetwothreadswithenoughdelaybetweenthemforJITto *kickin. *@paramargs *@throwsInterruptedException
*/ publicstaticvoid main(String[] args) throws InterruptedException
{ // let this run for a bit, so the "run" below is JITTed. for (int id = 0; id < 20; id++) {
System.out.println("Starting thread: " + id);
Test6912517 bug = new Test6912517(id);
bug.setShouldCheckThreads(true); Thread.sleep(2500);
}
}
/** *@seejava.lang.Runnable#run()
*/ publicvoid run()
{ long runNumber = 0; while (true) { // run hot for a little while, give JIT time to kick in to this loop. // then run less hot. if (runNumber > 15000) { try { Thread.sleep(5);
} catch (InterruptedException e) {
e.printStackTrace();
}
}
runNumber++;
ensureProperCallingThread();
}
}
privatevoid ensureProperCallingThread()
{ // this should never be null. but with the JIT bug, it will be. // JIT BUG IS HERE ==>>>>> if (myShouldCheckThreads) { if (myInitialThread == null) {
myInitialThread = Thread.currentThread();
} elseif (myInitialThread != Thread.currentThread()) {
System.out.println("Not working: " + myInitialThread.getName());
}
}
}
}
Messung V0.5 in Prozent
¤ Dauer der Verarbeitung: 0.8 Sekunden
(vorverarbeitet am 2026-06-10)
¤
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.