public class FileLockList
extends java.lang.Object
implements java.io.Serializable
Contains a list of the current locks on a file.
Constructor and Description |
---|
FileLockList()
Construct an empty file lock list.
|
Modifier and Type | Method and Description |
---|---|
void |
addLock(FileLock lock)
Add a lock to the list
|
boolean |
allowsLock(FileLock lock)
Check if the new lock should be allowed by comparing with the locks in the list.
|
boolean |
canReadFile(FileLock lock)
Check if the file is readable for the specified section of the file and process id
|
boolean |
canReadFile(long offset,
long len,
int pid)
Check if the file is readable for the specified section of the file and process id
|
boolean |
canWriteFile(FileLock lock)
Check if the file is writeable for the specified section of the file and process id
|
boolean |
canWriteFile(long offset,
long len,
int pid)
Check if the file is writeable for the specified section of the file and process id
|
FileLock |
findLock(FileLock lock)
Find the matching lock
|
FileLock |
findLock(long offset,
long len,
int pid)
Find the matching lock
|
FileLock |
getLockAt(int idx)
Return the specified lock details
|
int |
numberOfLocks()
Return the count of locks in the list.
|
void |
removeAllLocks()
Remove all locks from the list
|
FileLock |
removeLock(FileLock lock)
Remove a lock from the list
|
FileLock |
removeLock(long offset,
long len,
int pid)
Remove a lock from the list
|
FileLock |
removeLockAt(int idx)
Remove the lock at the specified index in the list
|
public final void addLock(FileLock lock)
lock
- Lock to be added to the list.public final FileLock findLock(FileLock lock)
lock
- FileLockpublic final FileLock findLock(long offset, long len, int pid)
offset
- longlen
- longpid
- intpublic final FileLock removeLock(FileLock lock)
lock
- FileLockpublic final FileLock removeLock(long offset, long len, int pid)
offset
- Starting offset of the locklen
- Locked section lengthpid
- Owner process idpublic final void removeAllLocks()
public final FileLock getLockAt(int idx)
idx
- Lock indexpublic final FileLock removeLockAt(int idx)
idx
- Lock indexpublic final boolean allowsLock(FileLock lock)
lock
- FileLockpublic final boolean canReadFile(FileLock lock)
lock
- FileLockpublic final boolean canReadFile(long offset, long len, int pid)
offset
- longlen
- longpid
- intpublic final boolean canWriteFile(FileLock lock)
lock
- FileLockpublic final boolean canWriteFile(long offset, long len, int pid)
offset
- longlen
- longpid
- intpublic final int numberOfLocks()
Copyright © 2005 - 2010 Alfresco Software, Inc. All Rights Reserved.