public class ProcessFileLock extends Object
FileLock.
ProcessFileLocks are not reentrant locks.
See create(java.lang.String) and release(org.apache.jena.dboe.base.file.ProcessFileLock) to obtain and stop using a ProcessFileLock.
| Modifier and Type | Method and Description |
|---|---|
static ProcessFileLock |
create(String filename)
Create a
ProcessFileLock using the named file. |
Path |
getPath() |
boolean |
isLockedHere()
Return true if this process holds the lock.
|
void |
lockEx()
Lock the file or throw
DBOpEnvException. |
void |
lockWait()
Lock the file or wait.
|
static void |
release(ProcessFileLock lockFile)
Return the lock, unlocking the file if this process has it locked.
|
boolean |
tryLock()
Lock a file, return true on success else false.
|
void |
unlock()
Release the lock - this must be paired with a "lock" operation.
|
public static ProcessFileLock create(String filename)
ProcessFileLock using the named file.
Locks are JVM-wide; each filename is associated with one lock object.public static void release(ProcessFileLock lockFile)
public void lockEx()
DBOpEnvException.AlreadyLocked - if the lock is already held by this process.public void lockWait()
AlreadyLocked - if the lock is already held by this process.public boolean tryLock()
AlreadyLocked - if the lock is already held by this process.public void unlock()
IllegalStateException - if the lock is not held by this process.public boolean isLockedHere()
public Path getPath()
Licensed under the Apache License, Version 2.0