void acquireExclusive() throws InterruptedIOException { // If full exclusive lock cannot be immediately obtained, it's due to a shared lock // being held for a long time. While waiting for the exclusive lock, all other shared // requests are queued. By waiting a timed amount and giving up, the exclusive lock // request is effectively de-prioritized. For each retry, the timeout is doubled, to // ensure that the exclusive request is not starved. long nanosTimeout = 1000; // 1 microsecond while (!finishAcquireExclusive(nanosTimeout)) { nanosTimeout <<= 1; } }
void acquireExclusive() throws InterruptedIOException { // If full exclusive lock cannot be immediately obtained, it's due to a shared lock // being held for a long time. While waiting for the exclusive lock, all other shared // requests are queued. By waiting a timed amount and giving up, the exclusive lock // request is effectively de-prioritized. For each retry, the timeout is doubled, to // ensure that the exclusive request is not starved. long nanosTimeout = 1000; // 1 microsecond while (!finishAcquireExclusive(nanosTimeout)) { nanosTimeout <<= 1; } }
void acquireExclusive() throws InterruptedIOException { // If full exclusive lock cannot be immediately obtained, it's due to a shared lock // being held for a long time. While waiting for the exclusive lock, all other shared // requests are queued. By waiting a timed amount and giving up, the exclusive lock // request is effectively de-prioritized. For each retry, the timeout is doubled, to // ensure that the exclusive request is not starved. long nanosTimeout = 1000; // 1 microsecond while (!finishAcquireExclusive(nanosTimeout)) { nanosTimeout <<= 1; } }