public class FileLock
extends java.lang.Object
implements java.io.Serializable
Contains the details of a single file lock.
Modifier and Type | Field and Description |
---|---|
static long |
LockWholeFile |
Modifier | Constructor and Description |
---|---|
protected |
FileLock()
Default constructor
|
|
FileLock(long offset,
long len,
int pid)
Class constructor
|
Modifier and Type | Method and Description |
---|---|
long |
getLength()
Get the locked section length
|
long |
getOffset()
Get the starting lock offset
|
int |
getProcessId()
Get the owner process id for the lock
|
boolean |
hasOverlap(FileLock lock)
Check if the specified locks byte range overlaps this locks byte range.
|
boolean |
hasOverlap(long offset,
long len)
Check if the specified locks byte range overlaps this locks byte range.
|
boolean |
isWholeFile()
Deterine if the lock is locking the whole file
|
void |
setLength(long len)
Set the locked section length
|
void |
setOffset(long offset)
Set the starting lock offset.
|
void |
setProcessId(int pid)
Set the process id of the owner of this lock
|
java.lang.String |
toString()
Return the lock details as a string
|
public static final long LockWholeFile
protected FileLock()
public FileLock(long offset, long len, int pid)
offset
- longlen
- longpid
- intpublic final long getOffset()
public final void setOffset(long offset)
offset
- Starting lock offsetpublic final long getLength()
public final void setLength(long len)
len
- Locked section lengthpublic final int getProcessId()
public final boolean isWholeFile()
public final void setProcessId(int pid)
pid
- intpublic final boolean hasOverlap(FileLock lock)
lock
- FileLockpublic final boolean hasOverlap(long offset, long len)
offset
- longlen
- longpublic java.lang.String toString()
toString
in class java.lang.Object
Copyright © 2005 - 2010 Alfresco Software, Inc. All Rights Reserved.