Class ReadWriteCache.Lock

java.lang.Object
org.hibernate.cache.ReadWriteCache.Lock
All Implemented Interfaces:
Serializable, SoftLock, ReadWriteCache.Lockable
Enclosing class:
ReadWriteCache

public static final class ReadWriteCache.Lock extends Object implements Serializable, ReadWriteCache.Lockable, SoftLock
A soft lock which supports concurrent locking, timestamped with the time it was released
See Also:
  • Constructor Details

    • Lock

      public Lock(long timeout, int id, Object version)
  • Method Details

    • getUnlockTimestamp

      public long getUnlockTimestamp()
    • lock

      public ReadWriteCache.Lock lock(long timeout, int id)
      Increment the lock, setting the new lock timeout
      Specified by:
      lock in interface ReadWriteCache.Lockable
    • unlock

      public void unlock(long currentTimestamp)
      Decrement the lock, setting the unlock timestamp if now unlocked
      Parameters:
      currentTimestamp -
    • isPuttable

      public boolean isPuttable(long txTimestamp, Object newVersion, Comparator comparator)
      Can the timestamped transaction re-cache this locked item now?
      Specified by:
      isPuttable in interface ReadWriteCache.Lockable
    • wasLockedConcurrently

      public boolean wasLockedConcurrently()
      Was this lock held concurrently by multiple transactions?
    • isLock

      public boolean isLock()
      Yes, this is a lock
      Specified by:
      isLock in interface ReadWriteCache.Lockable
    • isGettable

      public boolean isGettable(long txTimestamp)
      locks are not returned to the client!
      Specified by:
      isGettable in interface ReadWriteCache.Lockable
    • getId

      public int getId()
    • toString

      public String toString()
      Overrides:
      toString in class Object