com.atlassian.confluence.cache.tangosol.hibernate
Class CoherenceCacheStrategy.Lock

java.lang.Object
  extended by com.atlassian.confluence.cache.tangosol.hibernate.CoherenceCacheStrategy.Lock
All Implemented Interfaces:
CoherenceCacheStrategy.Lockable, java.io.Serializable, net.sf.hibernate.cache.CacheConcurrencyStrategy.SoftLock
Enclosing class:
CoherenceCacheStrategy

public static final class CoherenceCacheStrategy.Lock
extends java.lang.Object
implements java.io.Serializable, CoherenceCacheStrategy.Lockable, net.sf.hibernate.cache.CacheConcurrencyStrategy.SoftLock

A soft lock which supports concurrent locking, timestamped with the time it was released

Author:
Gavin King
See Also:
Serialized Form

Constructor Summary
CoherenceCacheStrategy.Lock(long timeout, int id, java.lang.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, java.lang.Object newVersion, java.util.Comparator comparator)
          Can the timestamped transaction re-cache this locked item now?
 CoherenceCacheStrategy.Lock lock(long timeout, int id)
          Increment the lock, setting the new lock timeout
 java.lang.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

CoherenceCacheStrategy.Lock

public CoherenceCacheStrategy.Lock(long timeout,
                                   int id,
                                   java.lang.Object version)
Method Detail

getUnlockTimestamp

public long getUnlockTimestamp()

lock

public CoherenceCacheStrategy.Lock lock(long timeout,
                                        int id)
Increment the lock, setting the new lock timeout

Specified by:
lock in interface CoherenceCacheStrategy.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,
                          java.lang.Object newVersion,
                          java.util.Comparator comparator)
Can the timestamped transaction re-cache this locked item now?

Specified by:
isPuttable in interface CoherenceCacheStrategy.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 CoherenceCacheStrategy.Lockable

isGettable

public boolean isGettable(long txTimestamp)
locks are not returned to the client!

Specified by:
isGettable in interface CoherenceCacheStrategy.Lockable

getId

public int getId()

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object


Copyright © 2003-2010 Atlassian. All Rights Reserved.