public void waitForUpdates() { if(!updatesLock.isWriteLocked()) { updatesLock.writeLock().lock(); } }
private String getFacetLockStatus() { StringBuilder str = new StringBuilder("Facet lock status for ["); str.append(getResource()); str.append("], is-write-locked=[").append(facetAccessLock.isWriteLocked()); str.append("], is-write-locked-by-current-thread=[").append(facetAccessLock.isWriteLockedByCurrentThread()); str.append("], read-locks=[").append(facetAccessLock.getReadLockCount()); str.append("], waiting-for-lock-queue-size=[").append(facetAccessLock.getQueueLength()); str.append("]"); return str.toString(); }
@Test public void testWriteLock() { ReentrantReadWriteLock lock = new ReentrantReadWriteLock(); AutoReadWriteLock al = new AutoReadWriteLock(lock); assertFalse(lock.isWriteLocked()); try (AutoLock al2 = al.autoWriteLock()) { assertTrue(lock.isWriteLocked()); } assertFalse(lock.isWriteLocked()); }
private boolean isFrozen() { return freezeLock.isWriteLocked(); }
/** * Clear internal fields. */ private void reset() { assert m_stateLock.isWriteLocked(); m_state = null; m_position = headerSize0; m_rootBlock = null; m_nextSequence = 0L; }
/** * Clear internal fields. */ private void reset() { assert m_stateLock.isWriteLocked(); m_state = null; m_position = headerSize0; m_rootBlock = null; m_nextSequence = 0L; }
@Override public boolean isWriteLocked() { return decorated.isWriteLocked(); }
private boolean isFrozen() { return freezeLock.isWriteLocked(); }
public boolean isWriteLocked() { return body.isWriteLocked(); } //}}}
private boolean isFrozen() { return freezeLock.isWriteLocked(); }
@SuppressWarnings("unused") private void onShare() { if (lock.localLock().isWriteLocked()) { throw new IllegalStateException("You are attempting to share a TerracottaReadWriteLock.WriteLock when it is in a locked state. " + "Locks cannot be shared while locked."); } }
@SuppressWarnings("unused") private void onShare() { if (lock.localLock().isWriteLocked()) { throw new IllegalStateException("You are attempting to share a TerracottaReadWriteLock.WriteLock when it is in a locked state. " + "Locks cannot be shared while locked."); } }
@Override public void close() throws IOException { if (currentOperationLock.isWriteLocked()) { currentOperationLock.writeLock().unlock(); } currentOperationLock.writeLock().lock(); currentOperation = CurrentOperation.CLOSING; currentOperationLock.writeLock().unlock(); try { queueLock.unlock(); } catch (IllegalMonitorStateException e) { } }
@Override public void close() throws IOException { if (currentOperationLock.isWriteLocked()) { currentOperationLock.writeLock().unlock(); } currentOperationLock.writeLock().lock(); currentOperation = CurrentOperation.CLOSING; currentOperationLock.writeLock().unlock(); try { queueLock.unlock(); } catch (IllegalMonitorStateException e) { } }
private static String getLockInfo(ReentrantReadWriteLock lock) { String lockid = "RWLock@" + Integer.toHexString(lock.hashCode()); return lockid + " readLockCount=" + lock.getReadLockCount() + " isWriteLocked=" + lock.isWriteLocked(); }
private void notifyUpgradingThread() { if (shouldTryAtomicUpgrade && tryingLockUpgrade.get()) { synchronized (highPriorityMonitor) { if (lock.getReadLockCount() < 2 && !lock.isWriteLocked()) { // all the read locks, except the one of the thread that is trying to upgrade its lock, have been released highPriorityMonitor.notifyAll(); } } } }
private static String getLockInfo(ReentrantReadWriteLock lock) { String lockid = "RWLock@" + Integer.toHexString(lock.hashCode()); return lockid + " readLockCount=" + lock.getReadLockCount() + " isWriteLocked=" + lock.isWriteLocked(); }
@SuppressWarnings("unused") private void onShare() { if ((localLock().getReadLockCount() > 0) || localLock().isWriteLocked()) { throw new IllegalStateException("You are attempting to share a TerracottaReadWriteLock when it is in a locked state. " + "Locks cannot be shared while locked."); } }
@SuppressWarnings("unused") private void onShare() { if ((localLock().getReadLockCount() > 0) || localLock().isWriteLocked()) { throw new IllegalStateException("You are attempting to share a TerracottaReadWriteLock when it is in a locked state. " + "Locks cannot be shared while locked."); } }
private void checkLockRelease(String path, MemoryLocksService lockService) { if (lockService.getMemoryLocks().getLockMap().get(path) == null) { // good lock is removed from memory after gc. } else { assertFalse(lockService.getMemoryLocks().getLockMap().get(path).isWriteLocked()); } }