Package net.sf.ehcache.transaction
Class ReadCommittedSoftLockImpl
- java.lang.Object
-
- net.sf.ehcache.transaction.ReadCommittedSoftLockImpl
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidclearTryLock()Clear the state of the soft lock after a tryLock() call succeeded.voidfreeze()Freeze the soft lock.ElementgetElement(TransactionID currentTransactionId, SoftLockID softLockId)Get the element the current transaction is supposed to see.java.lang.ObjectgetKey()Get the key of the element this soft lock is guardingbooleanisExpired()Check if the soft lock expired, ie: that the thread which locked it diedvoidlock()Lock the soft lockjava.lang.StringtoString()booleantryLock(long ms)Attempt to lock the soft lockvoidunfreeze()Unfreeze the soft lockvoidunlock()Unlock the soft lock.
-
-
-
Method Detail
-
getKey
public java.lang.Object getKey()
Get the key of the element this soft lock is guarding
-
getElement
public Element getElement(TransactionID currentTransactionId, SoftLockID softLockId)
Get the element the current transaction is supposed to see.- Specified by:
getElementin interfaceSoftLock- Parameters:
currentTransactionId- the current transaction under which this call is executedsoftLockId- the soft lock ID- Returns:
- the Element visible to the current transaction
-
tryLock
public boolean tryLock(long ms) throws java.lang.InterruptedExceptionAttempt to lock the soft lock
-
clearTryLock
public void clearTryLock()
Clear the state of the soft lock after a tryLock() call succeeded.- Specified by:
clearTryLockin interfaceSoftLock
-
unlock
public void unlock()
Unlock the soft lock. Once a soft lock got unlocked, it is considered 'dead': it cannot be locked again and must be cleaned up
-
freeze
public void freeze()
Freeze the soft lock. A soft lock should only be frozen for a very short period of time as this blocks theSoftLock.getElement(TransactionID, SoftLockID)method calls. Freeze is used to mark the start of a commit / rollback phase
-
isExpired
public boolean isExpired()
Check if the soft lock expired, ie: that the thread which locked it died
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
-