public class ReadWriteNaturalIdRegionAccessStrategy extends java.lang.Object implements NaturalIdRegionAccessStrategy
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 |
---|
ReadWriteNaturalIdRegionAccessStrategy(JCacheNaturalIdRegion jCacheNaturalIdRegion) |
Modifier and Type | Method and Description |
---|---|
boolean |
afterInsert(SharedSessionContractImplementor session,
java.lang.Object key,
java.lang.Object value)
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,
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[] naturalIdValues,
EntityPersister persister,
SharedSessionContractImplementor session)
To create instances of NaturalIdCacheKey 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[] |
getNaturalIdValues(java.lang.Object cacheKey)
Performs reverse operation to
NaturalIdRegionAccessStrategy.generateCacheKey(Object[], EntityPersister, SharedSessionContractImplementor) , returning
the original naturalIdValues. |
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)
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)
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 ReadWriteNaturalIdRegionAccessStrategy(JCacheNaturalIdRegion jCacheNaturalIdRegion)
public boolean insert(SharedSessionContractImplementor session, java.lang.Object key, java.lang.Object value) throws CacheException
NaturalIdRegionAccessStrategy
insert
in interface NaturalIdRegionAccessStrategy
session
- Current sessionkey
- The item keyvalue
- The itemCacheException
- Propagated from underlying Region
public boolean afterInsert(SharedSessionContractImplementor session, java.lang.Object key, java.lang.Object value) throws CacheException
NaturalIdRegionAccessStrategy
afterInsert
in interface NaturalIdRegionAccessStrategy
session
- Current sessionkey
- The item keyvalue
- The itemCacheException
- Propagated from underlying Region
public boolean update(SharedSessionContractImplementor session, java.lang.Object key, java.lang.Object value) throws CacheException
NaturalIdRegionAccessStrategy
update
in interface NaturalIdRegionAccessStrategy
session
- Current sessionkey
- The item keyvalue
- The itemCacheException
- Propagated from underlying Region
public boolean afterUpdate(SharedSessionContractImplementor session, java.lang.Object key, java.lang.Object value, SoftLock lock) throws CacheException
NaturalIdRegionAccessStrategy
afterUpdate
in interface NaturalIdRegionAccessStrategy
session
- Current sessionkey
- The item keyvalue
- The itemlock
- The lock previously obtained from RegionAccessStrategy.lockItem(org.hibernate.engine.spi.SharedSessionContractImplementor, java.lang.Object, java.lang.Object)
CacheException
- Propogated from underlying Region
public java.lang.Object generateCacheKey(java.lang.Object[] naturalIdValues, EntityPersister persister, SharedSessionContractImplementor session)
NaturalIdRegionAccessStrategy
generateCacheKey
in interface NaturalIdRegionAccessStrategy
naturalIdValues
- the sequence of values which unequivocally identifies a cached element on this regionpersister
- the persister of the element being cachedpublic java.lang.Object[] getNaturalIdValues(java.lang.Object cacheKey)
NaturalIdRegionAccessStrategy
NaturalIdRegionAccessStrategy.generateCacheKey(Object[], EntityPersister, SharedSessionContractImplementor)
, returning
the original naturalIdValues.getNaturalIdValues
in interface NaturalIdRegionAccessStrategy
cacheKey
- key returned from NaturalIdRegionAccessStrategy.generateCacheKey(Object[], EntityPersister, SharedSessionContractImplementor)
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.