Interface LockTable

All Known Implementing Classes:
ConcurrentLockSet

interface LockTable
Interface which must be implemented by lock table classes.
  • Method Details

    • lockObject

      Lock lockObject(CompatibilitySpace compatibilitySpace, Lockable ref, Object qualifier, int timeout) throws StandardException
      Lock an object.
      Parameters:
      compatibilitySpace - the compatibility space
      ref - the object to lock
      qualifier - qualifier of the lock
      timeout - maximum time to wait in milliseconds (C_LockFactory.NO_WAIT means don't wait)
      Returns:
      a reference to the lock, or null if the lock couldn't be obtained immediately and the timeout was NO_WAIT or LockOwner had the noWait flag set
      Throws:
      StandardException - if the lock could not be obtained
    • unlock

      void unlock(Latch item, int unlockCount)
      Unlock an object previously locked by lockObject().
      Parameters:
      item - the lock to unlock
      unlockCount - the number of times to unlock the item; or zero, meaning take the unlock count from the item
    • unlockReference

      Lock unlockReference(CompatibilitySpace space, Lockable ref, Object qualifier, Map group)
      Unlock an object once if it is present in the specified group. Also remove the object from the group.
      Parameters:
      space - the compatibility space
      ref - a reference to the locked object
      qualifier - qualifier of the lock
      group - a map representing the locks in a group
      Returns:
      the corresponding lock in the group map, or null if the object was not unlocked
    • oneMoreWaiter

      void oneMoreWaiter()
      Notify the lock table that it has one more waiter.
    • oneLessWaiter

      void oneLessWaiter()
      Notify the lock table that it has one less waiter.
    • anyoneBlocked

      boolean anyoneBlocked()
      Check whether there are anyone blocked in the lock table.
      Returns:
      true if someone is blocked, false otherwise
    • zeroDurationLockObject

      boolean zeroDurationLockObject(CompatibilitySpace space, Lockable ref, Object qualifier, int timeout) throws StandardException
      Lock an object and release the lock immediately. Equivalent to
       Lock lock = lockTable.lockObject(space, ref, qualifier, timeout);
       lockTable.unlock(lock, 1);
       
      except that the implementation might be more efficient.
      Parameters:
      space - the compatibility space
      ref - a reference to the locked object
      qualifier - qualifier of the lock
      timeout - maximum time to wait in milliseconds (C_LockFactory.NO_WAIT means don't wait)
      Returns:
      true if the object was locked, or false if the object couldn't be locked immediately and timeout was NO_WAIT or LockOwner had the noWait flag set
      Throws:
      StandardException - if the lock could not be obtained
    • shallowClone

      Map shallowClone()
      Create a map containing a snapshot of all the (Lockable, LockControl) pairs in the lock table.
      Returns:
      a shallow clone of the lock table
    • setDeadlockTimeout

      void setDeadlockTimeout(int timeout)
      Set the deadlock timeout.
      Parameters:
      timeout - deadlock timeout in milliseconds
    • setWaitTimeout

      void setWaitTimeout(int timeout)
      Set the wait timeout.
      Parameters:
      timeout - wait timeout in milliseconds
    • getWaitTimeout

      int getWaitTimeout()
      Get the wait timeout in milliseconds.
    • setDeadlockTrace

      void setDeadlockTrace(boolean flag)
      Enable or disable tracing of deadlocks.
      Parameters:
      flag - true enables tracing, false disables tracing
    • addWaiters

      void addWaiters(Map<Object,Object> waiters)
      Add all waiters in the lock table to the specified map.
      Parameters:
      waiters - the map to add the waiters to
      See Also: