diff --git a/src/java.base/share/classes/java/lang/VirtualThread.java b/src/java.base/share/classes/java/lang/VirtualThread.java index 2fbef98e7437c..937aa31dbe290 100644 --- a/src/java.base/share/classes/java/lang/VirtualThread.java +++ b/src/java.base/share/classes/java/lang/VirtualThread.java @@ -628,15 +628,15 @@ private void afterYield() { // Object.wait if (s == WAITING || s == TIMED_WAITING) { - byte nonce; + byte seqNo; int newState; if (s == WAITING) { - nonce = 0; // not used + seqNo = 0; // not used setState(newState = WAIT); } else { // synchronize with timeout task (previous timed-wait may be running) synchronized (timedWaitLock()) { - nonce = ++timedWaitSeqNo; + seqNo = ++timedWaitSeqNo; setState(newState = TIMED_WAIT); } } @@ -659,7 +659,7 @@ private void afterYield() { // schedule wakeup if (newState == TIMED_WAIT) { assert waitTimeout > 0; - waitTimeoutTask = schedule(() -> waitTimeoutExpired(nonce), waitTimeout, MILLISECONDS); + waitTimeoutTask = schedule(() -> waitTimeoutExpired(seqNo), waitTimeout, MILLISECONDS); } return; } @@ -945,12 +945,12 @@ private void unblock() { * and submit its task so that it continues and attempts to reenter the monitor. * This method does nothing if the thread has been woken by notify or interrupt. */ - private void waitTimeoutExpired(byte nounce) { + private void waitTimeoutExpired(byte seqNo) { assert !Thread.currentThread().isVirtual(); for (;;) { boolean unblocked = false; synchronized (timedWaitLock()) { - if (nounce != timedWaitSeqNo) { + if (seqNo != timedWaitSeqNo) { // this timeout task is for a past timed-wait return; } @@ -1394,7 +1394,7 @@ private Object carrierThreadAccessLock() { } /** - * Returns a lock object to coordinating timed-wait setup and timeout handling. + * Returns a lock object for coordinating timed-wait setup and timeout handling. */ private Object timedWaitLock() { // use this object for now to avoid the overhead of introducing another lock