public class FileStateLockManager extends java.lang.Object implements LockManager, OpLockManager, java.lang.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(java.lang.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(java.lang.String path)
Return the oplock details for a path, or null if there is no oplock on the path
|
boolean |
grantOpLock(java.lang.String path,
OpLockDetails oplock,
NetworkFile netFile)
Grant an oplock, store the oplock details
|
int |
hasOpLock(java.lang.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(java.lang.String path)
Release an oplock
|
void |
requestOpLockBreak(java.lang.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(java.lang.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, java.io.IOException
lockFile in interface LockManagersess - SrvSessiontree - TreeConnectionfile - NetworkFilelock - FileLockLockConflictExceptionjava.io.IOExceptionpublic void unlockFile(SrvSession sess, TreeConnection tree, NetworkFile file, FileLock lock) throws NotLockedException, java.io.IOException
unlockFile in interface LockManagersess - SrvSessiontree - TreeConnectionfile - NetworkFilelock - FileLockNotLockedExceptionjava.io.IOExceptionpublic 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(java.lang.String path)
hasOpLock in interface OpLockManagerpath - Stringpublic OpLockDetails getOpLockDetails(java.lang.String path)
getOpLockDetails in interface OpLockManagerpath - Stringpublic boolean grantOpLock(java.lang.String path,
OpLockDetails oplock,
NetworkFile netFile)
throws ExistingOpLockException
grantOpLock in interface OpLockManagerpath - Stringoplock - OpLockDetailsnetFile - NetworkFileExistingOpLockException - If the file already has an oplockpublic void requestOpLockBreak(java.lang.String path,
OpLockDetails oplock,
SMBSrvSession sess,
SMBSrvPacket pkt)
throws java.io.IOException,
DeferFailedException
requestOpLockBreak in interface OpLockManagerpath - Stringoplock - OpLockDetailssess - SMBSrvSessionpkt - SMBSrvPacketjava.io.IOExceptionDeferFailedExceptionpublic void releaseOpLock(java.lang.String path)
releaseOpLock in interface OpLockManagerpath - Stringpublic void changeOpLockType(OpLockDetails oplock, int newTyp)
changeOpLockType in interface OpLockManageroplock - OpLockDetailsnewTyp - intpublic void cancelOplockTimer(java.lang.String path)
cancelOplockTimer in interface OpLockManagerpath - Stringpublic int checkExpiredOplockBreaks()
checkExpiredOplockBreaks in interface OpLockManagerpublic void run()
run in interface java.lang.Runnablepublic final void shutdownRequest()
public final void startLockManager(java.lang.String threadName,
ThreadRequestPool threadPool)
threadName - StringthreadPool - ThreadRequestPoolCopyright © 2005 - 2010 Alfresco Software, Inc. All Rights Reserved.