@NotThreadSafe public class SimpleInodeLockList extends Object implements InodeLockList
Constructor and Description |
---|
SimpleInodeLockList(InodeLockManager inodeLockManager)
Creates a new empty lock list.
|
Modifier and Type | Method and Description |
---|---|
void |
close()
Closes the lock list, releasing all locks.
|
void |
downgradeEdgeToInode(Inode inode,
LockMode mode)
Downgrades from edge write-locking to inode write-locking.
|
void |
downgradeLastEdge()
Downgrades the last edge lock in the lock list from WRITE lock to READ lock.
|
void |
downgradeLastInode()
Downgrades the last inode from a write lock to a read lock.
|
boolean |
endsInInode() |
Inode |
get(int index) |
InodeLockManager |
getInodeLockManager() |
List<Inode> |
getLockedInodes() |
LockMode |
getLockMode() |
boolean |
isEmpty() |
void |
lockEdge(Inode lastInode,
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.
|
String |
toString() |
void |
unlockLastEdge()
Unlocks the last locked edge.
|
void |
unlockLastInode()
Unlocks the last locked inode.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
getLockedInodeViews
public SimpleInodeLockList(InodeLockManager inodeLockManager)
inodeLockManager
- manager for inode lockspublic void lockInode(Inode inode, LockMode mode)
InodeLockList
lockInode
in interface InodeLockList
inode
- the inode to lockmode
- the mode to lock inpublic void lockEdge(Inode lastInode, String childName, LockMode mode)
InodeLockList
lockEdge
in interface InodeLockList
lastInode
- the parent inode of the edgechildName
- the child name of the edgemode
- the mode to lock inpublic void lockRootEdge(LockMode mode)
InodeLockList
lockRootEdge
in interface InodeLockList
mode
- the mode to lock inpublic 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 void unlockLastInode()
InodeLockList
unlockLastInode
in interface InodeLockList
public void unlockLastEdge()
InodeLockList
unlockLastEdge
in interface InodeLockList
public void downgradeLastInode()
InodeLockList
downgradeLastInode
in interface InodeLockList
public void downgradeLastEdge()
InodeLockList
downgradeLastEdge
in interface InodeLockList
public void downgradeEdgeToInode(Inode inode, LockMode mode)
InodeLockList
downgradeEdgeToInode
in interface InodeLockList
inode
- the next inode in the lock listmode
- the mode to downgrade topublic 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 isEmpty()
isEmpty
in interface InodeLockList
public InodeLockManager getInodeLockManager()
getInodeLockManager
in interface InodeLockList
public boolean endsInInode()
endsInInode
in interface InodeLockList
public void close()
InodeLockList
close
in interface InodeLockList
close
in interface AutoCloseable
Copyright © 2023. All Rights Reserved.