T
- the type of the enclosed cache regionabstract class AbstractReadWriteEhcacheAccessStrategy<T extends EhcacheTransactionalDataRegion> extends AbstractEhcacheAccessStrategy<T>
Modifier and Type | Class and Description |
---|---|
protected static class |
AbstractReadWriteEhcacheAccessStrategy.Item
Wrapper type representing unlocked items.
|
protected static class |
AbstractReadWriteEhcacheAccessStrategy.Lock
Wrapper type representing locked items.
|
protected static interface |
AbstractReadWriteEhcacheAccessStrategy.Lockable
Interface type implemented by all wrapper objects in the cache.
|
Modifier and Type | Field and Description |
---|---|
private static org.slf4j.Logger |
LOG |
private java.util.concurrent.atomic.AtomicLong |
nextLockId |
private java.util.UUID |
uuid |
private java.util.Comparator |
versionComparator |
region, settings
Constructor and Description |
---|
AbstractReadWriteEhcacheAccessStrategy(T region,
org.hibernate.cfg.Settings settings)
Creates a read/write cache access strategy around the given cache region.
|
Modifier and Type | Method and Description |
---|---|
protected void |
decrementLock(java.lang.Object key,
AbstractReadWriteEhcacheAccessStrategy.Lock lock)
Unlock and re-put the given key, lock combination.
|
java.lang.Object |
get(java.lang.Object key,
long txTimestamp)
Returns
null if the item is not readable. |
protected void |
handleMissingLock(java.lang.Object key,
AbstractReadWriteEhcacheAccessStrategy.Lockable lock)
Handle the timeout of a previous lock mapped to this key
|
org.hibernate.cache.access.SoftLock |
lockItem(java.lang.Object key,
java.lang.Object version)
Soft-lock a cache item.
|
private long |
nextLockId() |
boolean |
putFromLoad(java.lang.Object key,
java.lang.Object value,
long txTimestamp,
java.lang.Object version,
boolean minimalPutOverride)
Returns
false and fails to put the value if there is an existing un-writeable item mapped to this
key. |
private void |
putLock(java.lang.Object key,
AbstractReadWriteEhcacheAccessStrategy.Lock newLock) |
private void |
readLockIfNeeded(java.lang.Object key)
Read lock the entry for the given key if internal cache locks will not provide correct exclusion.
|
private void |
readUnlockIfNeeded(java.lang.Object key)
Read unlock the entry for the given key if internal cache locks will not provide correct exclusion.
|
void |
unlockItem(java.lang.Object key,
org.hibernate.cache.access.SoftLock lock)
Soft-unlock a cache item.
|
evict, evictAll, lockRegion, putFromLoad, remove, removeAll, unlockRegion
private static final org.slf4j.Logger LOG
private final java.util.UUID uuid
private final java.util.concurrent.atomic.AtomicLong nextLockId
private final java.util.Comparator versionComparator
public AbstractReadWriteEhcacheAccessStrategy(T region, org.hibernate.cfg.Settings settings)
public final java.lang.Object get(java.lang.Object key, long txTimestamp) throws org.hibernate.cache.CacheException
null
if the item is not readable. Locked items are not readable, nor are items created
after the start of this transaction.org.hibernate.cache.CacheException
EntityRegionAccessStrategy.get(java.lang.Object, long)
,
CollectionRegionAccessStrategy.get(java.lang.Object, long)
public final boolean putFromLoad(java.lang.Object key, java.lang.Object value, long txTimestamp, java.lang.Object version, boolean minimalPutOverride) throws org.hibernate.cache.CacheException
false
and fails to put the value if there is an existing un-writeable item mapped to this
key.putFromLoad
in class AbstractEhcacheAccessStrategy<T extends EhcacheTransactionalDataRegion>
org.hibernate.cache.CacheException
EntityRegionAccessStrategy.putFromLoad(java.lang.Object, java.lang.Object, long, java.lang.Object, boolean)
,
CollectionRegionAccessStrategy.putFromLoad(java.lang.Object, java.lang.Object, long, java.lang.Object, boolean)
public final org.hibernate.cache.access.SoftLock lockItem(java.lang.Object key, java.lang.Object version) throws org.hibernate.cache.CacheException
org.hibernate.cache.CacheException
EntityRegionAccessStrategy.lockItem(java.lang.Object, java.lang.Object)
,
CollectionRegionAccessStrategy.lockItem(java.lang.Object, java.lang.Object)
public final void unlockItem(java.lang.Object key, org.hibernate.cache.access.SoftLock lock) throws org.hibernate.cache.CacheException
org.hibernate.cache.CacheException
EntityRegionAccessStrategy.unlockItem(java.lang.Object, org.hibernate.cache.access.SoftLock)
,
CollectionRegionAccessStrategy.unlockItem(java.lang.Object, org.hibernate.cache.access.SoftLock)
private long nextLockId()
protected void decrementLock(java.lang.Object key, AbstractReadWriteEhcacheAccessStrategy.Lock lock)
protected void handleMissingLock(java.lang.Object key, AbstractReadWriteEhcacheAccessStrategy.Lockable lock)
private void putLock(java.lang.Object key, AbstractReadWriteEhcacheAccessStrategy.Lock newLock)
private void readLockIfNeeded(java.lang.Object key)
private void readUnlockIfNeeded(java.lang.Object key)