protected static final class AbstractReadWriteEhcacheAccessStrategy.Lock extends java.lang.Object implements java.io.Serializable, AbstractReadWriteEhcacheAccessStrategy.Lockable, org.hibernate.cache.access.SoftLock
Modifier and Type | Field and Description |
---|---|
private boolean |
concurrent |
private long |
lockId |
private int |
multiplicity |
private static long |
serialVersionUID |
private java.util.UUID |
sourceUuid |
private long |
timeout |
private long |
unlockTimestamp |
private java.lang.Object |
version |
Constructor and Description |
---|
Lock(long timeout,
java.util.UUID sourceUuid,
long lockId,
java.lang.Object version)
Creates a locked item with the given identifiers and object version.
|
Modifier and Type | Method and Description |
---|---|
boolean |
equals(java.lang.Object o) |
java.lang.Object |
getValue()
Returns the enclosed value.
|
int |
hashCode() |
boolean |
isLocked()
Tells whether the Lock is currently held
|
boolean |
isReadable(long txTimestamp)
Returns
true if the enclosed value can be read by a transaction started at the given time. |
boolean |
isUnlockable(org.hibernate.cache.access.SoftLock lock)
Returns
true if the given lock can be unlocked using the given SoftLock instance as a handle. |
boolean |
isWriteable(long txTimestamp,
java.lang.Object newVersion,
java.util.Comparator versionComparator)
Returns
true if the enclosed value can be replaced with one of the given version by a
transaction started at the given time. |
AbstractReadWriteEhcacheAccessStrategy.Lock |
lock(long timeout,
java.util.UUID uuid,
long lockId)
Locks this entry, stamping it with the UUID and lockId given, with the lock timeout occuring at the specified
time.
|
java.lang.String |
toString() |
void |
unlock(long timestamp)
Unlocks this Lock, and timestamps the unlock event.
|
boolean |
wasLockedConcurrently()
Returns true if this Lock has been concurrently locked by more than one transaction.
|
private static final long serialVersionUID
private final java.util.UUID sourceUuid
private final long lockId
private final java.lang.Object version
private long timeout
private boolean concurrent
private int multiplicity
private long unlockTimestamp
Lock(long timeout, java.util.UUID sourceUuid, long lockId, java.lang.Object version)
public boolean isReadable(long txTimestamp)
true
if the enclosed value can be read by a transaction started at the given time.isReadable
in interface AbstractReadWriteEhcacheAccessStrategy.Lockable
public boolean isWriteable(long txTimestamp, java.lang.Object newVersion, java.util.Comparator versionComparator)
true
if the enclosed value can be replaced with one of the given version by a
transaction started at the given time.isWriteable
in interface AbstractReadWriteEhcacheAccessStrategy.Lockable
public java.lang.Object getValue()
getValue
in interface AbstractReadWriteEhcacheAccessStrategy.Lockable
public boolean isUnlockable(org.hibernate.cache.access.SoftLock lock)
true
if the given lock can be unlocked using the given SoftLock instance as a handle.isUnlockable
in interface AbstractReadWriteEhcacheAccessStrategy.Lockable
public boolean equals(java.lang.Object o)
equals
in class java.lang.Object
public int hashCode()
hashCode
in class java.lang.Object
public boolean wasLockedConcurrently()
public AbstractReadWriteEhcacheAccessStrategy.Lock lock(long timeout, java.util.UUID uuid, long lockId)
lock
in interface AbstractReadWriteEhcacheAccessStrategy.Lockable
public void unlock(long timestamp)
public java.lang.String toString()
toString
in class java.lang.Object
public boolean isLocked()