public abstract class AbstractReadWriteAccessStrategy extends BaseRegionAccessStrategy
Modifier and Type | Class and Description |
---|---|
static class |
AbstractReadWriteAccessStrategy.Item
Wrapper type representing unlocked items.
|
static class |
AbstractReadWriteAccessStrategy.Lock
Wrapper type representing locked items.
|
static interface |
AbstractReadWriteAccessStrategy.Lockable
Interface type implemented by all wrapper objects in the cache.
|
Modifier and Type | Field and Description |
---|---|
protected java.util.concurrent.locks.Lock |
readLock |
protected java.util.concurrent.locks.Lock |
writeLock |
Constructor and Description |
---|
AbstractReadWriteAccessStrategy() |
Modifier and Type | Method and Description |
---|---|
protected void |
decrementLock(SharedSessionContractImplementor session,
java.lang.Object key,
AbstractReadWriteAccessStrategy.Lock lock)
Unlock and re-put the given key, lock combination.
|
java.lang.Object |
get(SharedSessionContractImplementor session,
java.lang.Object key,
long txTimestamp)
Returns
null if the item is not readable. |
protected void |
handleLockExpiry(SharedSessionContractImplementor session,
java.lang.Object key,
AbstractReadWriteAccessStrategy.Lockable lock)
Handle the timeout of a previous lock mapped to this key
|
SoftLock |
lockItem(SharedSessionContractImplementor session,
java.lang.Object key,
java.lang.Object version)
Soft-lock a cache item.
|
boolean |
putFromLoad(SharedSessionContractImplementor session,
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. |
void |
unlockItem(SharedSessionContractImplementor session,
java.lang.Object key,
SoftLock lock)
Soft-unlock a cache item.
|
evict, evictAll, getInternalRegion, isDefaultMinimalPutOverride, lockRegion, putFromLoad, remove, removeAll, unlockRegion
protected java.util.concurrent.locks.Lock readLock
protected java.util.concurrent.locks.Lock writeLock
public final java.lang.Object get(SharedSessionContractImplementor session, java.lang.Object key, long txTimestamp) throws CacheException
null
if the item is not readable. Locked items are not readable, nor are items created
after the start of this transaction.get
in interface RegionAccessStrategy
get
in class BaseRegionAccessStrategy
session
- Current session.key
- The key of the item to be retrieved.txTimestamp
- a timestamp prior to the transaction start timeCacheException
- Propogated from underlying Region
public final boolean putFromLoad(SharedSessionContractImplementor session, java.lang.Object key, java.lang.Object value, long txTimestamp, java.lang.Object version, boolean minimalPutOverride) throws CacheException
false
and fails to put the value if there is an existing un-writeable item mapped to this
key.putFromLoad
in interface RegionAccessStrategy
putFromLoad
in class BaseRegionAccessStrategy
session
- Current session.key
- The item keyvalue
- The itemtxTimestamp
- a timestamp prior to the transaction start timeversion
- the item version numberminimalPutOverride
- Explicit minimalPut flagCacheException
- Propogated from underlying Region
public final SoftLock lockItem(SharedSessionContractImplementor session, java.lang.Object key, java.lang.Object version) throws CacheException
lockItem
in interface RegionAccessStrategy
lockItem
in class BaseRegionAccessStrategy
session
- Current session.key
- The key of the item to lockversion
- The item's current version valueCacheException
- Propogated from underlying Region
public final void unlockItem(SharedSessionContractImplementor session, java.lang.Object key, SoftLock lock) throws CacheException
unlockItem
in interface RegionAccessStrategy
unlockItem
in class BaseRegionAccessStrategy
session
- Current session.key
- The item keylock
- The lock previously obtained from RegionAccessStrategy.lockItem(org.hibernate.engine.spi.SharedSessionContractImplementor, java.lang.Object, java.lang.Object)
CacheException
- Propogated from underlying Region
protected void decrementLock(SharedSessionContractImplementor session, java.lang.Object key, AbstractReadWriteAccessStrategy.Lock lock)
protected void handleLockExpiry(SharedSessionContractImplementor session, java.lang.Object key, AbstractReadWriteAccessStrategy.Lockable lock)
Copyright © 2001-2018 Red Hat, Inc. All Rights Reserved.