public class InodeLockManager extends Object implements Closeable
Constructor and Description |
---|
InodeLockManager()
Creates a new instance of
InodeLockManager . |
Modifier and Type | Method and Description |
---|---|
void |
assertAllLocksReleased()
Asserts that all locks have been released, throwing an exception if any locks are still taken.
|
void |
close() |
RWLockResource |
lockEdge(Edge edge,
LockMode mode,
boolean useTryLock)
Acquires an edge lock.
|
RWLockResource |
lockInode(InodeView inode,
LockMode mode,
boolean useTryLock)
Acquires an inode lock.
|
LockResource |
lockUpdate(long inodeId)
Acquires the lock for modifying an inode's last modified time or size.
|
Optional<Scoped> |
tryAcquirePersistingLock(long inodeId)
Tries to acquire a lock for persisting the specified inode id.
|
Optional<RWLockResource> |
tryLockEdge(Edge edge,
LockMode mode)
Attempts to acquire an edge lock.
|
Optional<RWLockResource> |
tryLockInode(Long inodeId,
LockMode mode)
Attempts to acquire an inode lock.
|
public InodeLockManager()
InodeLockManager
.public void assertAllLocksReleased()
public RWLockResource lockInode(InodeView inode, LockMode mode, boolean useTryLock)
inode
- the inode to lockmode
- the mode to lock inuseTryLock
- whether to acquire with Lock.tryLock()
or Lock.lock()
. This
method differs from tryLockInode(Long, LockMode)
because it will
block until the inode has been successfully locked.tryLockInode(Long, LockMode)
public Optional<RWLockResource> tryLockInode(Long inodeId, LockMode mode)
inodeId
- the inode id to try lockingmode
- the mode to lock inpublic RWLockResource lockEdge(Edge edge, LockMode mode, boolean useTryLock)
edge
- the edge to lockmode
- the mode to lock inuseTryLock
- whether to acquire with Lock.tryLock()
or Lock.lock()
. This
method differs from tryLockEdge(Edge, LockMode)
because it will
block until the edge has been successfully locked.tryLockEdge(Edge, LockMode)
public Optional<RWLockResource> tryLockEdge(Edge edge, LockMode mode)
edge
- the edge to try lockingmode
- the mode to lock inpublic Optional<Scoped> tryAcquirePersistingLock(long inodeId)
inodeId
- the inode to acquire the lock forpublic LockResource lockUpdate(long inodeId)
inodeId
- the id of the inode to lockpublic void close() throws IOException
close
in interface Closeable
close
in interface AutoCloseable
IOException
Copyright © 2023. All Rights Reserved.