Class CoherenceRegionValue
java.lang.Object
com.oracle.coherence.hibernate.cache.v6.region.CoherenceRegionValue
- All Implemented Interfaces:
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:
-
Nested Class Summary
Modifier and TypeClassDescriptionstatic class
A CoherenceRegion.CoherenceRegionValue.SoftLock is an object representing a "soft lock" on an entry in second-level cache. -
Constructor Summary
ConstructorDescriptionCoherenceRegionValue
(Object value, Object version, long timestamp) Complete constructor. -
Method Summary
Modifier and TypeMethodDescriptionvoid
addSoftLock
(CoherenceRegionValue.SoftLock softLock) Adds a SoftLock to this cache value.boolean
long
Returns the "timestamp" of the "actual" value in this cache value.getValue()
Returns the "actual" value in this cache value.Returns the "version" of the "actual" value in this cache value.int
hashCode()
boolean
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
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.toString()
-
Constructor Details
-
CoherenceRegionValue
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 Details
-
getValue
Returns the "actual" value in this cache value.- Returns:
- the Object that is the "actual" value in this cache value
-
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
-
equals
-
hashCode
public int hashCode() -
toString
-
addSoftLock
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
-