java.lang.Object
org.apache.jena.tdb1.base.file.LocationLock
Represents a lock on a TDB location
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbooleancanLock()Gets whether the location is lockable i.e.booleanGets whether the current JVM can obtain the lockintgetOwner()Gets the current owner of this locations lock.booleanisLocked()Gets whether the location is currently lockedbooleanisOwned()Gets whether the lock is owned by the current processvoidobtain()Obtains the lock in order to prevent other JVMs using the locationvoidrelease()Releases the lock so that other JVMs can use the location
-
Constructor Details
-
LocationLock
-
-
Method Details
-
canLock
public boolean canLock()Gets whether the location is lockable i.e. is it an on-disk location where we can use a lock file to prevent multi-process access and the potential data corruption that ensues- Returns:
- True if the location is lockable
-
isLocked
public boolean isLocked()Gets whether the location is currently locked- Returns:
- boolean
-
isOwned
public boolean isOwned()Gets whether the lock is owned by the current process- Returns:
- True if the location is locked and owned by the process, false otherwise
-
getOwner
public int getOwner()Gets the current owner of this locations lock.- Returns:
- Process ID of owner if locked, zero if the location cannot be locked or not currently locked
-
canObtain
public boolean canObtain()Gets whether the current JVM can obtain the lock- Returns:
- True if the lock can be obtained (or is already held), false otherwise
-
obtain
public void obtain()Obtains the lock in order to prevent other JVMs using the location -
release
public void release()Releases the lock so that other JVMs can use the location
-