Thread refHandler = findThread("Reference Handler"); if (refHandler == null) thrownew Exception("Couldn't find Reference-handler thread"); if (!refHandler.isAlive()) thrownew Exception("Reference-handler thread is not alive");
/* Invoke a Reference constructor, passing null for the queue */
fork(new Runnable() { publicvoid run() {
r = new WeakReference(new Object(), null);
}});
/* Force the reference to be cleared and enqueued by the GC */ for (int i = 0;; i++) { Thread.sleep(10);
System.gc(); if (r.get() == null) break; if (i >= 10) thrownew Exception("Couldn't cause weak ref to be cleared");
}
/* Check that the handler is still alive */ if (!refHandler.isAlive()) thrownew Exception("Reference-handler thread died");
}
}
Messung V0.5 in Prozent
¤ Dauer der Verarbeitung: 0.10 Sekunden
(vorverarbeitet am 2026-10-11)
¤
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.