Class LocationLock

java.lang.Object
org.apache.jena.tdb1.base.file.LocationLock

public class LocationLock extends Object
Represents a lock on a TDB location
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    boolean
    Gets whether the location is lockable i.e.
    boolean
    Gets whether the current JVM can obtain the lock
    int
    Gets the current owner of this locations lock.
    boolean
    Gets whether the location is currently locked
    boolean
    Gets whether the lock is owned by the current process
    void
    Obtains the lock in order to prevent other JVMs using the location
    void
    Releases the lock so that other JVMs can use the location

    Methods inherited from class java.lang.Object

    equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • LocationLock

      public LocationLock(Location location)
  • 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