{
public void run() {
while (true) {
- tryHandlePending(true);
+ processPendingReferences();
}
}
}
- /**
- * Try handle pending {@link Reference} if there is one.
- * Return {@code true} as a hint that there might be another
- * {@link Reference} pending or {@code false} when there are no more pending
- * {@link Reference}s at the moment and the program can do some other
- * useful work instead of looping.
- *
- * @param waitForNotify if {@code true} and there was no pending
- * {@link Reference}, wait until notified from VM
- * or interrupted; if {@code false}, return immediately
- * when there is no pending {@link Reference}.
- * @return {@code true} if there was a {@link Reference} pending and it
- * was processed, or we waited for notification and either got it
- * or thread was interrupted before being notified;
- * {@code false} otherwise.
+ /* Atomically get and clear (set to null) the VM's pending list.
*/
- static boolean tryHandlePending(boolean waitForNotify) {
- Reference