@NotThreadSafe public class CompositeInodeLockList extends Object implements InodeLockList
Constructor and Description |
---|
CompositeInodeLockList(InodeLockList baseLockList,
boolean useTryLock)
Constructs a new lock list, using an existing lock list as the base list.
|
Modifier and Type | Method and Description |
---|---|
void |
close()
Closes the lock list, releasing all locks.
|
void |
downgradeLastEdge()
Downgrades the last edge lock in the lock list from WRITE lock to READ lock.
|
void |
downgradeToReadLocks()
Downgrades all locks in the current lock list to read locks.
|
boolean |
endsInInode() |
Inode |
get(int index) |
InodeLockManager |
getInodeLockManager() |
List<Inode> |
getLockedInodes() |
LockMode |
getLockMode() |
boolean |
isEmpty() |
void |
lockEdge(Inode inode,
String childName,
LockMode mode)
Locks an edge leading out of the last inode in the list.
|
void |
lockInode(Inode inode,
LockMode mode)
Locks the given inode and adds it to the lock list.
|
void |
lockRootEdge(LockMode mode)
Locks the root edge in the specified mode.
|
int |
numInodes() |
void |
pushWriteLockedEdge(Inode inode,
String childName)
Leapfrogs the final edge write lock forward, reducing the lock list's write-locked scope.
|
void |
unlockLastEdge()
Unlocks the last locked edge.
|
void |
unlockLastInode()
Unlocks the last locked inode.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
getLockedInodeViews
public CompositeInodeLockList(InodeLockList baseLockList, boolean useTryLock)
baseLockList
- the base InodeLockList
to useuseTryLock
- whether or not use Lock.tryLock()
or Lock.lock()
public void lockRootEdge(LockMode mode)
InodeLockList
lockRootEdge
in interface InodeLockList
mode
- the mode to lock inpublic void lockInode(Inode inode, LockMode mode)
InodeLockList
lockInode
in interface InodeLockList
inode
- the inode to lockmode
- the mode to lock inpublic void lockEdge(Inode inode, String childName, LockMode mode)
InodeLockList
lockEdge
in interface InodeLockList
inode
- the parent inode of the edgechildName
- the child name of the edgemode
- the mode to lock inpublic void unlockLastInode()
InodeLockList
unlockLastInode
in interface InodeLockList
public void unlockLastEdge()
InodeLockList
unlockLastEdge
in interface InodeLockList
public void downgradeToReadLocks()
InodeLockList
downgradeToReadLocks
in interface InodeLockList
public void downgradeLastEdge()
InodeLockList
downgradeLastEdge
in interface InodeLockList
public void pushWriteLockedEdge(Inode inode, String childName)
InodeLockList
pushWriteLockedEdge
in interface InodeLockList
inode
- the inode to add to the lock listchildName
- the child name for the edge to add to the lock listpublic LockMode getLockMode()
getLockMode
in interface InodeLockList
LockMode.WRITE
if the last entry in the list is write-locked, otherwise
LockMode.READ
public List<Inode> getLockedInodes()
getLockedInodes
in interface InodeLockList
public Inode get(int index)
get
in interface InodeLockList
index
- the index of the listpublic int numInodes()
numInodes
in interface InodeLockList
public boolean endsInInode()
endsInInode
in interface InodeLockList
public boolean isEmpty()
isEmpty
in interface InodeLockList
public InodeLockManager getInodeLockManager()
getInodeLockManager
in interface InodeLockList
public void close()
InodeLockList
close
in interface InodeLockList
close
in interface AutoCloseable
Copyright © 2023. All Rights Reserved.