org.hibernate.cache
Class ReadWriteCache.Lock

java.lang.Object
  extended by 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

Author:
Gavin King
See Also:
Serialized Form

Constructor Summary
ReadWriteCache.Lock(long timeout, int id, Object version)
           
 
Method Summary
 int getId()
           
 long getUnlockTimestamp()
           
 boolean isGettable(long txTimestamp)
          locks are not returned to the client!
 boolean isLock()
          Yes, this is a lock
 boolean isPuttable(long txTimestamp, Object newVersion, Comparator comparator)
          Can the timestamped transaction re-cache this locked item now?
 ReadWriteCache.Lock lock(long timeout, int id)
          Increment the lock, setting the new lock timeout
 String toString()
           
 void unlock(long currentTimestamp)
          Decrement the lock, setting the unlock timestamp if now unlocked
 boolean wasLockedConcurrently()
          Was this lock held concurrently by multiple transactions?
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

ReadWriteCache.Lock

public ReadWriteCache.Lock(long timeout,
                           int id,
                           Object version)
Method Detail

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


Copyright © null-null Red Hat Middleware, LLC. All Rights Reserved