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 LockManagersess - SrvSessiontree - TreeConnectionfile - NetworkFilelock - FileLockLockConflictExceptionIOExceptionpublic void unlockFile(SrvSession sess, TreeConnection tree, NetworkFile file, FileLock lock) throws NotLockedException, IOException
unlockFile in interface LockManagersess - SrvSessiontree - TreeConnectionfile - NetworkFilelock - FileLockNotLockedExceptionIOExceptionpublic FileLock createLockObject(SrvSession sess, TreeConnection tree, NetworkFile file, long offset, long len, int pid)
createLockObject in interface LockManagersess - SrvSessiontree - TreeConnectionfile - NetworkFileoffset - longlen - longpid - intpublic void releaseLocksForFile(SrvSession sess, TreeConnection tree, NetworkFile file)
releaseLocksForFile in interface LockManagersess - SrvSessiontree - TreeConnectionfile - NetworkFilepublic int hasOpLock(String path)
hasOpLock in interface OpLockManagerpath - Stringpublic OpLockDetails getOpLockDetails(String path)
getOpLockDetails in interface OpLockManagerpath - Stringpublic boolean grantOpLock(String path, OpLockDetails oplock, NetworkFile netFile) throws ExistingOpLockException
grantOpLock in interface OpLockManagerpath - 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 OpLockManagerpath - Stringoplock - OpLockDetailssess - SMBSrvSessionpkt - SMBSrvPacketIOExceptionDeferFailedExceptionpublic void releaseOpLock(String path)
releaseOpLock in interface OpLockManagerpath - Stringpublic void changeOpLockType(OpLockDetails oplock, int newTyp)
changeOpLockType in interface OpLockManageroplock - OpLockDetailsnewTyp - intpublic void cancelOplockTimer(String path)
cancelOplockTimer in interface OpLockManagerpath - Stringpublic int checkExpiredOplockBreaks()
checkExpiredOplockBreaks in interface OpLockManagerpublic final void shutdownRequest()
public final void startLockManager(String threadName, ThreadRequestPool threadPool)
threadName - StringthreadPool - ThreadRequestPoolCopyright © 2005–2016 Alfresco Software. All rights reserved.