Class CoherenceRegionValue
- java.lang.Object
-
- com.oracle.coherence.hibernate.cache.v53.region.CoherenceRegionValue
-
- All Implemented Interfaces:
Serializable
public class CoherenceRegionValue extends Object implements Serializable
A CoherenceRegion.CoherenceRegionValue is an object representing a value in Hibernate's second-level cache. It holds the "actual" cache value, as well as a "version" object and a timestamp (i.e. a long) used by Hibernate. It further keeps track of its state with respect to soft-locked-ness, and the number of soft locks currently in effect on it.- Author:
- Randy Stafford, Gunnar Hillert
- See Also:
- Serialized Form
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
CoherenceRegionValue.SoftLock
A CoherenceRegion.CoherenceRegionValue.SoftLock is an object representing a "soft lock" on an entry in second-level cache.
-
Constructor Summary
Constructors Constructor Description CoherenceRegionValue(Object value, Object version, long timestamp)
Complete constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addSoftLock(CoherenceRegionValue.SoftLock softLock)
Adds a SoftLock to this cache value.boolean
equals(Object someObject)
long
getTimestamp()
Returns the "timestamp" of the "actual" value in this cache value.Object
getValue()
Returns the "actual" value in this cache value.Object
getVersion()
Returns the "version" of the "actual" value in this cache value.int
hashCode()
boolean
isNotSoftLocked()
Returns a boolean indicating whether this cache value is not currently soft-locked.boolean
isReplaceableFromLoad(long txTimestamp, Object replacementVersion, Comparator<Object> versionComparator)
Returns a boolean indicating whether this cache value is replaceable from database load.boolean
isSoftLocked()
Returns a boolean indicating whether this cache value is currently soft-locked.void
releaseSoftLock(org.hibernate.cache.spi.access.SoftLock softLock, long timeOfRelease)
Attempts to release the argument SoftLock on this cache value.String
toString()
-
-
-
Constructor Detail
-
CoherenceRegionValue
public CoherenceRegionValue(Object value, Object version, long timestamp)
Complete constructor.- Parameters:
value
- the actual value in this cache valueversion
- the version of the actual value in this cache valuetimestamp
- the timestamp of the actual value in this cache value
-
-
Method Detail
-
getValue
public Object getValue()
Returns the "actual" value in this cache value.- Returns:
- the Object that is the "actual" value in this cache value
-
getVersion
public Object getVersion()
Returns the "version" of the "actual" value in this cache value.- Returns:
- the Object that is the "version" of the "actual" value in this cache value
-
getTimestamp
public long getTimestamp()
Returns the "timestamp" of the "actual" value in this cache value.- Returns:
- the long "timestamp" of the "actual" value in this cache value
-
addSoftLock
public void addSoftLock(CoherenceRegionValue.SoftLock softLock)
Adds a SoftLock to this cache value.- Parameters:
softLock
- the SoftLock to add
-
isReplaceableFromLoad
public boolean isReplaceableFromLoad(long txTimestamp, Object replacementVersion, Comparator<Object> versionComparator)
Returns a boolean indicating whether this cache value is replaceable from database load.- Parameters:
txTimestamp
- From Hibernate javadoc, "a timestamp prior to the transaction start time" [where "the transaction" loaded the potential replacement value from database]replacementVersion
- the version of the would-be replacementversionComparator
- a Comparator for comparing entity versions- Returns:
- a boolean indicating whether this cache value is replaceable from database load
-
isNotSoftLocked
public boolean isNotSoftLocked()
Returns a boolean indicating whether this cache value is not currently soft-locked.- Returns:
- a boolean indicating whether this cache value is not currently soft-locked
-
isSoftLocked
public boolean isSoftLocked()
Returns a boolean indicating whether this cache value is currently soft-locked.- Returns:
- a boolean indicating whether this cache value is currently soft-locked
-
releaseSoftLock
public void releaseSoftLock(org.hibernate.cache.spi.access.SoftLock softLock, long timeOfRelease)
Attempts to release the argument SoftLock on this cache value. Has no effect if soft locks are not released in the same order in which they were acquired.- Parameters:
softLock
- the SoftLock whose release to attempttimeOfRelease
- the time at which the SoftLock was released
-
-