public class FileStateLockManager extends Object implements LockManager, OpLockManager, Runnable
Lock manager implementation for byte range locking and oplocks that uses the file state cache to track locks/oplocks.
Constructor and Description |
---|
FileStateLockManager(FileStateCache stateCache)
Class constructor
|
Modifier and Type | Method and Description |
---|---|
void |
cancelOplockTimer(String path)
Cancel an oplock break timer
|
void |
changeOpLockType(OpLockDetails oplock,
int newTyp)
Change an oplock type
|
int |
checkExpiredOplockBreaks()
Check for expired oplock break requests
|
FileLock |
createLockObject(SrvSession sess,
TreeConnection tree,
NetworkFile file,
long offset,
long len,
int pid)
Create a file lock object.
|
OpLockDetails |
getOpLockDetails(String path)
Return the oplock details for a path, or null if there is no oplock on the path
|
boolean |
grantOpLock(String path,
OpLockDetails oplock,
NetworkFile netFile)
Grant an oplock, store the oplock details
|
int |
hasOpLock(String path)
Check if there is an oplock for the specified path, return the oplock type.
|
void |
lockFile(SrvSession sess,
TreeConnection tree,
NetworkFile file,
FileLock lock)
Lock a byte range within a file, or the whole file.
|
void |
releaseLocksForFile(SrvSession sess,
TreeConnection tree,
NetworkFile file)
Release all locks that a session has on a file.
|
void |
releaseOpLock(String path)
Release an oplock
|
void |
requestOpLockBreak(String path,
OpLockDetails oplock,
SMBSrvSession sess,
SMBSrvPacket pkt)
Request an oplock break on the specified oplock
|
void |
run()
Run the oplock break expiry
|
void |
shutdownRequest()
Request the oplock break expiry thread to shutdown
|
void |
startLockManager(String threadName,
ThreadRequestPool threadPool)
Start the lock manager
|
void |
unlockFile(SrvSession sess,
TreeConnection tree,
NetworkFile file,
FileLock lock)
Unlock a byte range within a file, or the whole file
|
public FileStateLockManager(FileStateCache stateCache)
stateCache
- FileStateCachepublic void lockFile(SrvSession sess, TreeConnection tree, NetworkFile file, FileLock lock) throws LockConflictException, IOException
lockFile
in interface LockManager
sess
- SrvSessiontree
- TreeConnectionfile
- NetworkFilelock
- FileLockLockConflictException
IOException
public void unlockFile(SrvSession sess, TreeConnection tree, NetworkFile file, FileLock lock) throws NotLockedException, IOException
unlockFile
in interface LockManager
sess
- SrvSessiontree
- TreeConnectionfile
- NetworkFilelock
- FileLockNotLockedException
IOException
public FileLock createLockObject(SrvSession sess, TreeConnection tree, NetworkFile file, long offset, long len, int pid)
createLockObject
in interface LockManager
sess
- SrvSessiontree
- TreeConnectionfile
- NetworkFileoffset
- longlen
- longpid
- intpublic void releaseLocksForFile(SrvSession sess, TreeConnection tree, NetworkFile file)
releaseLocksForFile
in interface LockManager
sess
- SrvSessiontree
- TreeConnectionfile
- NetworkFilepublic int hasOpLock(String path)
hasOpLock
in interface OpLockManager
path
- Stringpublic OpLockDetails getOpLockDetails(String path)
getOpLockDetails
in interface OpLockManager
path
- Stringpublic boolean grantOpLock(String path, OpLockDetails oplock, NetworkFile netFile) throws ExistingOpLockException
grantOpLock
in interface OpLockManager
path
- Stringoplock
- OpLockDetailsnetFile
- NetworkFileExistingOpLockException
- If the file already has an oplockpublic void requestOpLockBreak(String path, OpLockDetails oplock, SMBSrvSession sess, SMBSrvPacket pkt) throws IOException, DeferFailedException
requestOpLockBreak
in interface OpLockManager
path
- Stringoplock
- OpLockDetailssess
- SMBSrvSessionpkt
- SMBSrvPacketIOException
DeferFailedException
public void releaseOpLock(String path)
releaseOpLock
in interface OpLockManager
path
- Stringpublic void changeOpLockType(OpLockDetails oplock, int newTyp)
changeOpLockType
in interface OpLockManager
oplock
- OpLockDetailsnewTyp
- intpublic void cancelOplockTimer(String path)
cancelOplockTimer
in interface OpLockManager
path
- Stringpublic int checkExpiredOplockBreaks()
checkExpiredOplockBreaks
in interface OpLockManager
public final void shutdownRequest()
public final void startLockManager(String threadName, ThreadRequestPool threadPool)
threadName
- StringthreadPool
- ThreadRequestPoolCopyright © 2005–2017 Alfresco Software. All rights reserved.