publicclass Main { publicstaticvoid main(String[] args) {
Object o = new Object(); // Generate a hashcode and put it in the lock word. int hashOrig = o.hashCode(); int hashInflated = 0; int hashSystemOrig = System.identityHashCode(o); int hashSystemInflated = 0; // Inflate the monitor to move the hash from the lock word to the Monitor. synchronized (o) {
hashInflated = o.hashCode();
hashSystemInflated = System.identityHashCode(o);
} // Make sure that all the hashes agree. if (hashOrig != hashInflated || hashOrig != hashSystemOrig ||
hashSystemOrig != hashSystemInflated) {
System.out.println("hash codes dont match: " + hashOrig + " " + hashInflated + " " +
hashSystemOrig + " " + hashSystemInflated);
}
System.out.println("Done.");
}
}
Messung V0.5 in Prozent
¤ Dauer der Verarbeitung: 0.1 Sekunden
(vorverarbeitet am 2026-06-29)
¤
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.