@Test public void lockInodeAfterInode() { mLockList.lockInode(mDirA, LockMode.READ); mThrown.expect(IllegalStateException.class); mLockList.lockInode(mDirB, LockMode.READ); }
@Override public void lockInode(Inode inode, LockMode mode) { mode = nextLockMode(mode); if (!mLocks.isEmpty()) { Preconditions.checkState(!endsInInode(), "Cannot lock inode %s for lock list %s because the lock list already ends in an inode", inode.getId(), this); Preconditions.checkState(inode.getName().equals(mLastEdge.getName()), "Expected to lock inode %s but locked inode %s", mLastEdge.getName(), inode.getName()); } lockAndAddInode(inode, mode); }
SimpleInodeLockList implements InodeLockList { @Override public void lockInode(Inode inode, LockMode mode) { mode = nextLockMode(mode); if (!mLocks.isEmpty()) { Preconditions.checkState(!endsInInode(), "Cannot lock inode %s for lock list %s because the lock list already ends in an inode", inode.getId(), this); Preconditions.checkState(inode.getName().equals(mLastEdge.getName()), "Expected to lock inode %s but locked inode %s", mLastEdge.getName(), inode.getName()); } lockAndAddInode(inode, mode); } }
SimpleInodeLockList implements InodeLockList { @Override public void lockInode(Inode inode, LockMode mode) { mode = nextLockMode(mode); if (!mLocks.isEmpty()) { Preconditions.checkState(!endsInInode(), "Cannot lock inode %s for lock list %s because the lock list already ends in an inode", inode.getId(), this); Preconditions.checkState(inode.getName().equals(mLastEdge.getName()), "Expected to lock inode %s but locked inode %s", mLastEdge.getName(), inode.getName()); } lockAndAddInode(inode, mode); } SimpleInodeLockList(InodeLockManager inodeLockManager, boolean useTryLock); }
SimpleInodeLockList implements InodeLockList { @Override public void lockInode(Inode inode, LockMode mode) { mode = nextLockMode(mode); if (!mLocks.isEmpty()) { Preconditions.checkState(!endsInInode(), "Cannot lock inode %s for lock list %s because the lock list already ends in an inode", inode.getId(), this); Preconditions.checkState(inode.getName().equals(mLastEdge.getName()), "Expected to lock inode %s but locked inode %s", mLastEdge.getName(), inode.getName()); } lockAndAddInode(inode, mode); } SimpleInodeLockList(InodeLockManager inodeLockManager, boolean useTryLock); @Override void lockInode(Inode inode, LockMode mode); @Override void lockEdge(Inode lastInode, String childName, LockMode mode); @Override void lockRootEdge(LockMode mode); @Override void pushWriteLockedEdge(Inode inode, String childName); @Override void unlockLastInode(); @Override void unlockLastEdge(); @Override void downgradeToReadLocks(); @Override void downgradeLastEdge(); @Override LockMode getLockMode(); @Override List<Inode> getLockedInodes(); @Override Inode get(int index); @Override int numInodes(); @Override boolean isEmpty(); @Override InodeLockManager getInodeLockManager(); @Override boolean endsInInode(); @Override String toString(); @Override void close(); }
SimpleInodeLockList implements InodeLockList { @Override public void lockInode(Inode inode, LockMode mode) { mode = nextLockMode(mode); if (!mLocks.isEmpty()) { Preconditions.checkState(!endsInInode(), "Cannot lock inode %s for lock list %s because the lock list already ends in an inode", inode.getId(), this); Preconditions.checkState(inode.getName().equals(mLastEdge.getName()), "Expected to lock inode %s but locked inode %s", mLastEdge.getName(), inode.getName()); } lockAndAddInode(inode, mode); } SimpleInodeLockList(InodeLockManager inodeLockManager, boolean useTryLock); @Override void lockInode(Inode inode, LockMode mode); @Override void lockEdge(Inode lastInode, String childName, LockMode mode); @Override void lockRootEdge(LockMode mode); @Override void pushWriteLockedEdge(Inode inode, String childName); @Override void unlockLastInode(); @Override void unlockLastEdge(); @Override void downgradeToReadLocks(); @Override void downgradeLastEdge(); @Override LockMode getLockMode(); @Override List<Inode> getLockedInodes(); @Override Inode get(int index); @Override int numInodes(); @Override boolean isEmpty(); @Override InodeLockManager getInodeLockManager(); @Override boolean endsInInode(); @Override String toString(); @Override void close();  }