public class CollectionReadWriteAccess extends AbstractReadWriteAccess implements CollectionDataAccess
CollectionDataAccess
using the AccessType.READ_WRITE
access type.AbstractReadWriteAccess.Item, AbstractReadWriteAccess.Lockable, AbstractReadWriteAccess.SoftLockImpl
Constructor and Description |
---|
CollectionReadWriteAccess(DomainDataRegion region,
CacheKeysFactory keysFactory,
DomainDataStorageAccess storageAccess,
CollectionDataCachingConfig config) |
Modifier and Type | Method and Description |
---|---|
Object |
generateCacheKey(Object id,
CollectionPersister collectionDescriptor,
SessionFactoryImplementor factory,
String tenantIdentifier)
To create instances of CollectionCacheKey for this region, Hibernate will invoke this method
exclusively so that generated implementations can generate optimised keys.
|
Object |
get(SharedSessionContractImplementor session,
Object key)
Returns
null if the item is not readable. |
protected AccessedDataClassification |
getAccessedDataClassification() |
AccessType |
getAccessType()
The type of access implemented
|
Object |
getCacheKeyId(Object cacheKey)
|
protected Comparator |
getVersionComparator() |
SoftLock |
lockItem(SharedSessionContractImplementor session,
Object key,
Object version)
We are going to attempt to update/delete the keyed object.
|
boolean |
putFromLoad(SharedSessionContractImplementor session,
Object key,
Object value,
Object version)
Attempt to cache an object, afterQuery loading from the database.
|
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.
|
decrementLock, handleLockExpiry, nextLockId, putFromLoad, readLock, remove, uuid, writeLock
clearCache, contains, destroy, evict, evictAll, getRegion, getStorageAccess, lockRegion, removeAll, unlockRegion
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
contains, evict, evictAll, getRegion, lockRegion, putFromLoad, remove, removeAll, unlockRegion
public CollectionReadWriteAccess(DomainDataRegion region, CacheKeysFactory keysFactory, DomainDataStorageAccess storageAccess, CollectionDataCachingConfig config)
protected AccessedDataClassification getAccessedDataClassification()
getAccessedDataClassification
in class AbstractReadWriteAccess
public AccessType getAccessType()
CachedDomainDataAccess
getAccessType
in interface CachedDomainDataAccess
public Object generateCacheKey(Object id, CollectionPersister collectionDescriptor, SessionFactoryImplementor factory, String tenantIdentifier)
CollectionDataAccess
generateCacheKey
in interface CollectionDataAccess
id
- the primary identifier of the CollectioncollectionDescriptor
- the descriptor of the collection for which a key is being generatedfactory
- a reference to the current SessionFactorytenantIdentifier
- the tenant id, or null if multi-tenancy is not being used.public Object getCacheKeyId(Object cacheKey)
CollectionDataAccess
CollectionDataAccess.generateCacheKey(java.lang.Object, org.hibernate.persister.collection.CollectionPersister, org.hibernate.engine.spi.SessionFactoryImplementor, java.lang.String)
getCacheKeyId
in interface CollectionDataAccess
cacheKey
- key previously returned from CollectionDataAccess.generateCacheKey(java.lang.Object, org.hibernate.persister.collection.CollectionPersister, org.hibernate.engine.spi.SessionFactoryImplementor, java.lang.String)
CollectionDataAccess.generateCacheKey(java.lang.Object, org.hibernate.persister.collection.CollectionPersister, org.hibernate.engine.spi.SessionFactoryImplementor, java.lang.String)
protected Comparator getVersionComparator()
getVersionComparator
in class AbstractReadWriteAccess
public Object get(SharedSessionContractImplementor session, Object key)
AbstractReadWriteAccess
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 AbstractReadWriteAccess
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 AbstractReadWriteAccess
session
- Current session.key
- The item keyvalue
- The itemversion
- the item version numbertrue
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.lockItem
in interface CachedDomainDataAccess
lockItem
in class AbstractReadWriteAccess
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
unlockItem
in interface CachedDomainDataAccess
unlockItem
in class AbstractReadWriteAccess
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)
Copyright © 2001-2018 Red Hat, Inc. All Rights Reserved.