Package org.apache.jena.dboe.base.file
Class ProcessFileLock
- java.lang.Object
-
- org.apache.jena.dboe.base.file.ProcessFileLock
-
public class ProcessFileLock extends java.lang.ObjectA simple packaging around aFileLock.ProcessFileLocks are not reentrant locks.See
create(java.lang.String)andrelease(org.apache.jena.dboe.base.file.ProcessFileLock)to obtain and stop using aProcessFileLock.
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static ProcessFileLockcreate(java.lang.String filename)Create aProcessFileLockusing the named file.java.nio.file.PathgetPath()booleanisLockedHere()Return true if this process holds the lock.voidlockEx()Lock the file or throwDBOpEnvException.voidlockWait()Lock the file or wait.static voidrelease(ProcessFileLock lockFile)Return the lock, unlocking the file if this process has it locked.booleantryLock()Lock a file, return true on success else false.voidunlock()Release the lock - this must be paired with a "lock" operation.
-
-
-
Method Detail
-
create
public static ProcessFileLock create(java.lang.String filename)
Create aProcessFileLockusing the named file. Locks are JVM-wide; each filename is associated with one lock object.
-
release
public static void release(ProcessFileLock lockFile)
Return the lock, unlocking the file if this process has it locked.
-
lockEx
public void lockEx()
Lock the file or throwDBOpEnvException.- Throws:
AlreadyLocked- if the lock is already held by this process.
-
lockWait
public void lockWait()
Lock the file or wait.- Throws:
AlreadyLocked- if the lock is already held by this process.
-
tryLock
public boolean tryLock()
Lock a file, return true on success else false.- Throws:
AlreadyLocked- if the lock is already held by this process.
-
unlock
public void unlock()
Release the lock - this must be paired with a "lock" operation.- Throws:
java.lang.IllegalStateException- if the lock is not held by this process.
-
isLockedHere
public boolean isLockedHere()
Return true if this process holds the lock.
-
getPath
public java.nio.file.Path getPath()
-
-