public interface Lock
Modifier and Type | Method and Description |
---|---|
File |
getFile()
Get the file this Lock was obtained for.
|
FileLock |
getLock() |
RandomAccessFile |
getRandomAccessFile()
Gets the random access file used to read/write the contents of the locked file.
|
boolean |
isShared()
Tells whether the lock is shared or exclusive.
|
void |
lock()
Lock the file this Lock was obtained for.
|
void |
unlock()
Unlock the file this Lock was obtained for.
|
RandomAccessFile getRandomAccessFile() throws IOException
null
if the lock isn't acquired.IOException
boolean isShared()
true
if the lock is shared, false
if the lock is exclusive.void lock() throws IOException
Multiple lock()
invocations on the same or other lock objects using the same (canonical) file as
target are possible and non-blocking from the same caller thread.
IOException
- if an error occurs while locking the file.void unlock() throws IOException
IOException
- if an error occurs while locking the file.File getFile()
null
.FileLock getLock()
Copyright © 2013–2017. All rights reserved.