Package org.apache.jena.dboe.base.file
Class ProcessFileLock
java.lang.Object
org.apache.jena.dboe.base.file.ProcessFileLock
A simple packaging around a
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.
-
Method Summary
Modifier and TypeMethodDescriptionstatic ProcessFileLockCreate aProcessFileLockusing the named file.getPath()booleanReturn 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 Details
-
create
Create aProcessFileLockusing the named file. Locks are JVM-wide; each filename is associated with one lock object. -
release
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:
IllegalStateException- if the lock is not held by this process.
-
isLockedHere
public boolean isLockedHere()Return true if this process holds the lock. -
getPath
-