public abstract class AbstractReadWriteAccess extends AbstractCachedDomainDataAccess
Modifier and Type | Class and Description |
---|---|
static class |
AbstractReadWriteAccess.Item
Wrapper type representing unlocked items.
|
static interface |
AbstractReadWriteAccess.Lockable
Interface type implemented by all wrapper objects in the cache.
|
static class |
AbstractReadWriteAccess.SoftLockImpl
Wrapper type representing locked items.
|
Modifier | Constructor and Description |
---|---|
protected |
AbstractReadWriteAccess(DomainDataRegion domainDataRegion,
DomainDataStorageAccess storageAccess) |
Modifier and Type | Method and Description |
---|---|
protected void |
decrementLock(SharedSessionContractImplementor session,
Object key,
AbstractReadWriteAccess.SoftLockImpl lock) |
Object |
get(SharedSessionContractImplementor session,
Object key)
Returns
null if the item is not readable. |
protected abstract AccessedDataClassification |
getAccessedDataClassification() |
protected abstract Comparator |
getVersionComparator() |
protected void |
handleLockExpiry(SharedSessionContractImplementor session,
Object key,
AbstractReadWriteAccess.Lockable lock) |
SoftLock |
lockItem(SharedSessionContractImplementor session,
Object key,
Object version)
We are going to attempt to update/delete the keyed object.
|
protected long |
nextLockId() |
boolean |
putFromLoad(SharedSessionContractImplementor session,
Object key,
Object value,
Object version)
Attempt to cache an object, afterQuery loading from the database.
|
boolean |
putFromLoad(SharedSessionContractImplementor session,
Object key,
Object value,
Object version,
boolean minimalPutOverride)
Attempt to cache an object, afterQuery loading from the database, explicitly
specifying the minimalPut behavior.
|
protected Lock |
readLock() |
void |
remove(SharedSessionContractImplementor session,
Object key)
Called afterQuery an item has become stale (beforeQuery the transaction completes).
|
void |
unlockItem(SharedSessionContractImplementor session,
Object key,
SoftLock lock)
Called when we have finished the attempted update/delete (which may or
may not have been successful), after transaction completion.
|
protected UUID |
uuid() |
protected Lock |
writeLock() |
clearCache, contains, destroy, evict, evictAll, getRegion, getStorageAccess, lockRegion, removeAll, unlockRegion
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
getAccessType
protected AbstractReadWriteAccess(DomainDataRegion domainDataRegion, DomainDataStorageAccess storageAccess)
protected abstract Comparator getVersionComparator()
protected UUID uuid()
protected long nextLockId()
protected Lock readLock()
protected Lock writeLock()
public Object get(SharedSessionContractImplementor session, Object key)
null
if the item is not readable. Locked items are not readable, nor are items created
afterQuery the start of this transaction.get
in interface CachedDomainDataAccess
get
in class AbstractCachedDomainDataAccess
session
- Current session.key
- The key of the item to be retrieved.null
public boolean putFromLoad(SharedSessionContractImplementor session, Object key, Object value, Object version)
CachedDomainDataAccess
putFromLoad
in interface CachedDomainDataAccess
putFromLoad
in class AbstractCachedDomainDataAccess
session
- Current session.key
- The item keyvalue
- The itemversion
- the item version numbertrue
if the object was successfully cachedprotected abstract AccessedDataClassification getAccessedDataClassification()
public final boolean putFromLoad(SharedSessionContractImplementor session, Object key, Object value, Object version, boolean minimalPutOverride)
CachedDomainDataAccess
putFromLoad
in interface CachedDomainDataAccess
putFromLoad
in class AbstractCachedDomainDataAccess
session
- Current session.key
- The item keyvalue
- The itemversion
- the item version numberminimalPutOverride
- Explicit minimalPut flagtrue
if the object was successfully cachedpublic SoftLock lockItem(SharedSessionContractImplementor session, Object key, Object version)
CachedDomainDataAccess
CachedDomainDataAccess.unlockItem(org.hibernate.engine.spi.SharedSessionContractImplementor, java.lang.Object, org.hibernate.cache.spi.access.SoftLock)
, to release the
lock. Concurrency strategies which do not support client-visible
locks may silently return null.session
- Current session.key
- The key of the item to lockversion
- The item's current version valuenull
.public void unlockItem(SharedSessionContractImplementor session, Object key, SoftLock lock)
CachedDomainDataAccess
session
- Current session.key
- The item keylock
- The lock previously obtained from CachedDomainDataAccess.lockItem(org.hibernate.engine.spi.SharedSessionContractImplementor, java.lang.Object, java.lang.Object)
protected void decrementLock(SharedSessionContractImplementor session, Object key, AbstractReadWriteAccess.SoftLockImpl lock)
protected void handleLockExpiry(SharedSessionContractImplementor session, Object key, AbstractReadWriteAccess.Lockable lock)
public void remove(SharedSessionContractImplementor session, Object key)
CachedDomainDataAccess
remove
in interface CachedDomainDataAccess
remove
in class AbstractCachedDomainDataAccess
session
- Current session.key
- The key of the item to removeCopyright © 2021 JBoss by Red Hat. All rights reserved.