V
Size: a a a
V
ГР
V
ГР
public final long awaitNanos(long nanosTimeout)
throws InterruptedException {
if (Thread.
interrupted())
throw new InterruptedException();
// We don't check for nanosTimeout <= 0L here, to allow
// awaitNanos(0) as a way to "yield the lock".
final long deadline = System.
nanoTime() + nanosTimeout;
long initialNanos = nanosTimeout;
Node node = addConditionWaiter();
long savedState = fullyRelease(node);
int interruptMode = 0;
while (!isOnSyncQueue(node)) {
if (nanosTimeout <= 0L) {
transferAfterCancelledWait(node);
break;
}
if (nanosTimeout >
SPIN_FOR_TIMEOUT_THRESHOLD)
LockSupport.
parkNanos(this, nanosTimeout);
if ((interruptMode = checkInterruptWhileWaiting(node)) != 0)
break;
nanosTimeout = deadline - System.
nanoTime();
}
if (acquireQueued(node, savedState) && interruptMode !=
THROW_IE)
interruptMode =
REINTERRUPT;
if (node.nextWaiter != null)
unlinkCancelledWaiters();
if (interruptMode != 0)
reportInterruptAfterWait(interruptMode);
long remaining = deadline - System.
nanoTime(); // avoid overflow
return (remaining <= initialNanos) ? remaining : Long.
MIN_VALUE;
}
V
Condition
.awaitNanos нужно понять. С такими вопросами лучше в @javastart, там охотнее ответятГР
V
V
ch
ch
SZ
AK
IE
AE
AE