@ThreadSafe public class InodeLockList extends Object implements AutoCloseable
Inode
.Modifier and Type | Field and Description |
---|---|
protected List<Inode<?>> |
mInodes |
protected List<InodeTree.LockMode> |
mLockModes |
Constructor and Description |
---|
InodeLockList()
Creates a new instance of
InodeLockList . |
Modifier and Type | Method and Description |
---|---|
void |
close() |
void |
downgradeLast()
Downgrades the last inode that was locked, if the inode was previously WRITE locked.
|
List<Inode<?>> |
getInodes() |
boolean |
isEmpty() |
void |
lockRead(Inode<?> inode)
Locks the given inode in read mode, and adds it to this lock list.
|
void |
lockReadAndCheckNameAndParent(Inode<?> inode,
Inode parent,
String name)
Locks the given inode in read mode, and adds it to this lock list.
|
void |
lockReadAndCheckParent(Inode<?> inode,
Inode parent)
Locks the given inode in read mode, and adds it to this lock list.
|
void |
lockWrite(Inode<?> inode)
Locks the given inode in write mode, and adds it to this lock list.
|
void |
lockWriteAndCheckNameAndParent(Inode<?> inode,
Inode parent,
String name)
Locks the given inode in write mode, and adds it to this lock list.
|
void |
lockWriteAndCheckParent(Inode<?> inode,
Inode parent)
Locks the given inode in write mode, and adds it to this lock list.
|
void |
unlockLast()
Unlocks the last inode that was locked.
|
protected List<InodeTree.LockMode> mLockModes
public InodeLockList()
InodeLockList
.public void lockRead(Inode<?> inode)
inode
- the inode to lockpublic void lockReadAndCheckParent(Inode<?> inode, Inode parent) throws InvalidPathException
inode
- the inode to lockparent
- the expected parent inodeInvalidPathException
- if the inode is no long consistent with the caller's expectationspublic void lockReadAndCheckNameAndParent(Inode<?> inode, Inode parent, String name) throws InvalidPathException
inode
- the inode to lockparent
- the expected parent inodename
- the expected name of the inode to be lockedInvalidPathException
- if the inode is not consistent with the caller's expectationspublic void unlockLast()
public void downgradeLast()
public void lockWrite(Inode<?> inode)
inode
- the inode to lockpublic void lockWriteAndCheckParent(Inode<?> inode, Inode parent) throws InvalidPathException
inode
- the inode to lockparent
- the expected parent inodeInvalidPathException
- if the inode is not consistent with the caller's expectationspublic void lockWriteAndCheckNameAndParent(Inode<?> inode, Inode parent, String name) throws InvalidPathException
inode
- the inode to lockparent
- the expected parent inodename
- the expected name of the inode to be lockedInvalidPathException
- if the inode is not consistent with the caller's expectationspublic List<Inode<?>> getInodes()
public boolean isEmpty()
public void close()
close
in interface AutoCloseable
Copyright © 2023. All Rights Reserved.