Package org.hibernate.cache.spi.support
Class AbstractReadWriteAccess.SoftLockImpl
- java.lang.Object
-
- org.hibernate.cache.spi.support.AbstractReadWriteAccess.SoftLockImpl
-
- All Implemented Interfaces:
java.io.Serializable,SoftLock,AbstractReadWriteAccess.Lockable
- Enclosing class:
- AbstractReadWriteAccess
public static class AbstractReadWriteAccess.SoftLockImpl extends java.lang.Object implements java.io.Serializable, AbstractReadWriteAccess.Lockable, SoftLock
Wrapper type representing locked items.- See Also:
- Serialized Form
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description booleanequals(java.lang.Object o)java.lang.ObjectgetValue()Returns the enclosed value.inthashCode()booleanisReadable(long txTimestamp)Returnstrueif the enclosed value can be read by a transaction started at the given time.booleanisUnlockable(SoftLock lock)Returnstrueif the given lock can be unlocked using the given SoftLock instance as a handle.booleanisWriteable(long txTimestamp, java.lang.Object newVersion, java.util.Comparator versionComparator)Returnstrueif the enclosed value can be replaced with one of the given version by a transaction started at the given time.AbstractReadWriteAccess.SoftLockImpllock(long timeout, java.util.UUID uuid, long lockId)Locks this entry, stamping it with the UUID and lockId given, with the lock timeout occurring at the specified time.java.lang.StringtoString()voidunlock(long timestamp)Unlocks this Lock, and timestamps the unlock event.booleanwasLockedConcurrently()Returns true if this Lock has been concurrently locked by more than one transaction.
-
-
-
Method Detail
-
isReadable
public boolean isReadable(long txTimestamp)
Description copied from interface:AbstractReadWriteAccess.LockableReturnstrueif the enclosed value can be read by a transaction started at the given time.- Specified by:
isReadablein interfaceAbstractReadWriteAccess.Lockable
-
isWriteable
public boolean isWriteable(long txTimestamp, java.lang.Object newVersion, java.util.Comparator versionComparator)Description copied from interface:AbstractReadWriteAccess.LockableReturnstrueif the enclosed value can be replaced with one of the given version by a transaction started at the given time.- Specified by:
isWriteablein interfaceAbstractReadWriteAccess.Lockable
-
getValue
public java.lang.Object getValue()
Description copied from interface:AbstractReadWriteAccess.LockableReturns the enclosed value.- Specified by:
getValuein interfaceAbstractReadWriteAccess.Lockable
-
isUnlockable
public boolean isUnlockable(SoftLock lock)
Description copied from interface:AbstractReadWriteAccess.LockableReturnstrueif the given lock can be unlocked using the given SoftLock instance as a handle.- Specified by:
isUnlockablein interfaceAbstractReadWriteAccess.Lockable
-
equals
public boolean equals(java.lang.Object o)
- Overrides:
equalsin classjava.lang.Object
-
hashCode
public int hashCode()
- Overrides:
hashCodein classjava.lang.Object
-
wasLockedConcurrently
public boolean wasLockedConcurrently()
Returns true if this Lock has been concurrently locked by more than one transaction.
-
lock
public AbstractReadWriteAccess.SoftLockImpl lock(long timeout, java.util.UUID uuid, long lockId)
Description copied from interface:AbstractReadWriteAccess.LockableLocks this entry, stamping it with the UUID and lockId given, with the lock timeout occurring at the specified time. The returned Lock object can be used to unlock the entry in the future.- Specified by:
lockin interfaceAbstractReadWriteAccess.Lockable
-
unlock
public void unlock(long timestamp)
Unlocks this Lock, and timestamps the unlock event.
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
-