public class ReadWriteEntityRegionAccessStrategy extends java.lang.Object implements EntityRegionAccessStrategy
Modifier and Type | Class and Description |
---|---|
protected static class |
org.hibernate.cache.jcache.access.AbstractReadWriteRegionAccessStrategy.Item
Wrapper type representing unlocked items.
|
static class |
org.hibernate.cache.jcache.access.AbstractReadWriteRegionAccessStrategy.Lock
Wrapper type representing locked items.
|
protected static interface |
org.hibernate.cache.jcache.access.AbstractReadWriteRegionAccessStrategy.Lockable
Interface type implemented by all wrapper objects in the cache.
|
Modifier and Type | Field and Description |
---|---|
protected R |
region |
protected java.util.Comparator |
versionComparator |
Constructor and Description |
---|
ReadWriteEntityRegionAccessStrategy(JCacheEntityRegion region) |
Modifier and Type | Method and Description |
---|---|
boolean |
afterInsert(SharedSessionContractImplementor session,
java.lang.Object key,
java.lang.Object value,
java.lang.Object version)
Called after an item has been inserted (after the transaction completes),
instead of calling release().
|
boolean |
afterUpdate(SharedSessionContractImplementor session,
java.lang.Object key,
java.lang.Object value,
java.lang.Object currentVersion,
java.lang.Object previousVersion,
SoftLock lock)
Called after an item has been updated (after the transaction completes),
instead of calling release().
|
void |
evict(java.lang.Object key) |
void |
evictAll() |
java.lang.Object |
generateCacheKey(java.lang.Object id,
EntityPersister persister,
SessionFactoryImplementor factory,
java.lang.String tenantIdentifier)
To create instances of keys for this region, Hibernate will invoke this method
exclusively so that generated implementations can generate optimised keys.
|
java.lang.Object |
get(SharedSessionContractImplementor session,
java.lang.Object key,
long txTimestamp) |
java.lang.Object |
getCacheKeyId(java.lang.Object cacheKey)
Performs reverse operation to
EntityRegionAccessStrategy.generateCacheKey(Object, EntityPersister, SessionFactoryImplementor, String) |
R |
getRegion() |
protected void |
handleMissingLock(java.lang.Object key,
org.hibernate.cache.jcache.access.AbstractReadWriteRegionAccessStrategy.Lockable lock) |
boolean |
insert(SharedSessionContractImplementor session,
java.lang.Object key,
java.lang.Object value,
java.lang.Object version)
Called after an item has been inserted (before the transaction completes),
instead of calling evict().
|
SoftLock |
lockItem(SharedSessionContractImplementor session,
java.lang.Object key,
java.lang.Object version) |
SoftLock |
lockRegion() |
protected long |
nextItemId() |
boolean |
putFromLoad(SharedSessionContractImplementor session,
java.lang.Object key,
java.lang.Object value,
long txTimestamp,
java.lang.Object version) |
boolean |
putFromLoad(SharedSessionContractImplementor session,
java.lang.Object key,
java.lang.Object value,
long txTimestamp,
java.lang.Object version,
boolean minimalPutOverride) |
void |
remove(SharedSessionContractImplementor session,
java.lang.Object key) |
void |
removeAll() |
void |
unlockItem(SharedSessionContractImplementor session,
java.lang.Object key,
SoftLock lock) |
void |
unlockRegion(SoftLock lock) |
boolean |
update(SharedSessionContractImplementor session,
java.lang.Object key,
java.lang.Object value,
java.lang.Object currentVersion,
java.lang.Object previousVersion)
Called after an item has been updated (before the transaction completes),
instead of calling evict().
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
getRegion
evict, evictAll, get, lockItem, lockRegion, putFromLoad, putFromLoad, remove, removeAll, unlockItem, unlockRegion
protected final R extends JCacheTransactionalDataRegion region
protected final java.util.Comparator versionComparator
public ReadWriteEntityRegionAccessStrategy(JCacheEntityRegion region)
public boolean insert(SharedSessionContractImplementor session, java.lang.Object key, java.lang.Object value, java.lang.Object version) throws CacheException
EntityRegionAccessStrategy
insert
in interface EntityRegionAccessStrategy
session
- Current sessionkey
- The item keyvalue
- The itemversion
- The item's version valueCacheException
- Propagated from underlying Region
public boolean afterInsert(SharedSessionContractImplementor session, java.lang.Object key, java.lang.Object value, java.lang.Object version) throws CacheException
EntityRegionAccessStrategy
afterInsert
in interface EntityRegionAccessStrategy
session
- Current sessionkey
- The item keyvalue
- The itemversion
- The item's version valueCacheException
- Propagated from underlying Region
public boolean update(SharedSessionContractImplementor session, java.lang.Object key, java.lang.Object value, java.lang.Object currentVersion, java.lang.Object previousVersion) throws CacheException
EntityRegionAccessStrategy
update
in interface EntityRegionAccessStrategy
session
- Current sessionkey
- The item keyvalue
- The itemcurrentVersion
- The item's current version valuepreviousVersion
- The item's previous version valueCacheException
- Propagated from underlying Region
public boolean afterUpdate(SharedSessionContractImplementor session, java.lang.Object key, java.lang.Object value, java.lang.Object currentVersion, java.lang.Object previousVersion, SoftLock lock) throws CacheException
EntityRegionAccessStrategy
afterUpdate
in interface EntityRegionAccessStrategy
session
- Current sessionkey
- The item keyvalue
- The itemcurrentVersion
- The item's current version valuepreviousVersion
- The item's previous version valuelock
- The lock previously obtained from RegionAccessStrategy.lockItem(org.hibernate.engine.spi.SharedSessionContractImplementor, java.lang.Object, java.lang.Object)
CacheException
- Propagated from underlying Region
public java.lang.Object generateCacheKey(java.lang.Object id, EntityPersister persister, SessionFactoryImplementor factory, java.lang.String tenantIdentifier)
EntityRegionAccessStrategy
generateCacheKey
in interface EntityRegionAccessStrategy
id
- the primary identifier of the entitypersister
- the persister for the type 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 java.lang.Object getCacheKeyId(java.lang.Object cacheKey)
EntityRegionAccessStrategy
EntityRegionAccessStrategy.generateCacheKey(Object, EntityPersister, SessionFactoryImplementor, String)
getCacheKeyId
in interface EntityRegionAccessStrategy
cacheKey
- key previously returned from EntityRegionAccessStrategy.generateCacheKey(Object, EntityPersister, SessionFactoryImplementor, String)
EntityRegionAccessStrategy.generateCacheKey(Object, EntityPersister, SessionFactoryImplementor, String)
public R getRegion()
public java.lang.Object get(SharedSessionContractImplementor session, java.lang.Object key, long txTimestamp) throws CacheException
CacheException
public boolean putFromLoad(SharedSessionContractImplementor session, java.lang.Object key, java.lang.Object value, long txTimestamp, java.lang.Object version) throws CacheException
CacheException
public boolean putFromLoad(SharedSessionContractImplementor session, java.lang.Object key, java.lang.Object value, long txTimestamp, java.lang.Object version, boolean minimalPutOverride) throws CacheException
CacheException
public SoftLock lockItem(SharedSessionContractImplementor session, java.lang.Object key, java.lang.Object version) throws CacheException
CacheException
public void unlockItem(SharedSessionContractImplementor session, java.lang.Object key, SoftLock lock) throws CacheException
CacheException
public void remove(SharedSessionContractImplementor session, java.lang.Object key) throws CacheException
CacheException
public void removeAll() throws CacheException
CacheException
public void evict(java.lang.Object key) throws CacheException
CacheException
public void evictAll() throws CacheException
CacheException
public SoftLock lockRegion() throws CacheException
CacheException
public void unlockRegion(SoftLock lock) throws CacheException
CacheException
protected long nextItemId()
protected void handleMissingLock(java.lang.Object key, org.hibernate.cache.jcache.access.AbstractReadWriteRegionAccessStrategy.Lockable lock)
Copyright © 2001-2018 Red Hat, Inc. All Rights Reserved.