void lock() throws IllegalStateException { while (true) { final boolean success = bytes.tryLockNanosLong(LOCK_OFFSET, lockTimeOutNS); if (success) return; if (currentThread().isInterrupted()) { throw new IllegalStateException( new InterruptedException("Unable to obtain lock, interrupted")); } else { errorListener.onLockTimeout(bytes.threadIdForLockLong(LOCK_OFFSET)); bytes.resetLockInt(LOCK_OFFSET); } } }
public void lock() throws IllegalStateException { while (true) { boolean success = bytes.tryLockNanosInt(LOCK, lockTimeOutNS); if (success) return; if (Thread.currentThread().isInterrupted()) { throw new IllegalStateException( new InterruptedException("Unable to obtain lock, interrupted")); } else { builder.errorListener().onLockTimeout(bytes.threadIdForLockInt(LOCK)); bytes.resetLockInt(LOCK); } } }