Package org.eclipse.tycho.locking.facade
Interface FileLocker
-
- All Known Implementing Classes:
FileLockerImpl
public interface FileLocker
Provides process-level file locking. Locking is advisory, meaning that processes must cooperatively use the same locking mechanism.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description boolean
isLocked()
Whether the file associated with this locker object is currently locked (by this process or any other process).void
lock()
Equivalent to {lock(long)
with a timeout argument of 10000 milliseconds.void
lock(long timeout)
Attempt to lock the file associated with this locker object.void
release()
Release the lock if acquired.
-
-
-
Method Detail
-
lock
void lock() throws LockTimeoutException
Equivalent to {lock(long)
with a timeout argument of 10000 milliseconds.- Throws:
LockTimeoutException
-
lock
void lock(long timeout) throws LockTimeoutException
Attempt to lock the file associated with this locker object. Note that technically, not the file itself is locked, but an empty marker file next to it.- Parameters:
timeout
- timeout in milliseconds- Throws:
LockTimeoutException
- if lock cannot be obtained for more than the specified timeout in millseconds.
-
release
void release()
Release the lock if acquired. Also removes the lock marker file.
-
isLocked
boolean isLocked()
Whether the file associated with this locker object is currently locked (by this process or any other process).
-
-