T - implementation type of HazelcastRegionpublic class ReadOnlyAccessDelegate<T extends HazelcastRegion> extends NonStrictReadWriteAccessDelegate<T>
cache, hazelcastRegion, log, versionComparator| Constructor and Description |
|---|
ReadOnlyAccessDelegate(T hazelcastRegion,
Properties props) |
| Modifier and Type | Method and Description |
|---|---|
boolean |
afterInsert(Object key,
Object value,
Object version)
Called after an item has been inserted (after the transaction completes),
instead of calling release().
|
boolean |
afterUpdate(Object key,
Object value,
Object currentVersion,
Object previousVersion,
org.hibernate.cache.access.SoftLock lock)
Called after an item has been updated (after the transaction completes),
instead of calling release().
|
boolean |
insert(Object key,
Object value,
Object version)
Called after an item has been inserted (before the transaction completes),
instead of calling evict().
|
org.hibernate.cache.access.SoftLock |
lockItem(Object key,
Object version)
We are going to attempt to update/delete the keyed object.
|
org.hibernate.cache.access.SoftLock |
lockRegion()
NO-OP
|
void |
removeAll()
Called to evict data from the entire region
|
void |
unlockItem(Object key,
org.hibernate.cache.access.SoftLock lock)
Called when we have finished the attempted update/delete (which may or
may not have been successful), after transaction completion.
|
void |
unlockRegion(org.hibernate.cache.access.SoftLock lock)
This will issue a log warning stating that an attempt was made to unlock a read-only cache region.
|
boolean |
update(Object key,
Object value,
Object currentVersion,
Object previousVersion)
Called after an item has been updated (before the transaction completes),
instead of calling evict().
|
removeevict, evictAll, get, getHazelcastRegion, putFromLoad, putFromLoadpublic ReadOnlyAccessDelegate(T hazelcastRegion, Properties props)
public boolean afterInsert(Object key, Object value, Object version) throws org.hibernate.cache.CacheException
NonStrictReadWriteAccessDelegate
Returns false since this is a non-strict read/write cache access strategy
afterInsert in interface AccessDelegate<T extends HazelcastRegion>afterInsert in class NonStrictReadWriteAccessDelegate<T extends HazelcastRegion>key - The item keyvalue - The itemversion - The item's version valueorg.hibernate.cache.CacheException - Propagated from underlying Regionpublic boolean afterUpdate(Object key, Object value, Object currentVersion, Object previousVersion, org.hibernate.cache.access.SoftLock lock) throws org.hibernate.cache.CacheException
AccessDelegateafterUpdate in interface AccessDelegate<T extends HazelcastRegion>afterUpdate in class NonStrictReadWriteAccessDelegate<T extends HazelcastRegion>key - The item keyvalue - The itemcurrentVersion - The item's current version valuepreviousVersion - The item's previous version valuelock - The lock previously obtained from AccessDelegate.lockItem(java.lang.Object, java.lang.Object)UnsupportedOperationException - Always thrown as we cannot update an item in a read-only cacheorg.hibernate.cache.CacheException - Propagated from underlying Regionpublic boolean insert(Object key, Object value, Object version) throws org.hibernate.cache.CacheException
Returns false since this is an asynchronous cache access strategy.
This cache is asynchronous hence a no-op
insert in interface AccessDelegate<T extends HazelcastRegion>insert in class NonStrictReadWriteAccessDelegate<T extends HazelcastRegion>key - The item keyvalue - The itemversion - The item's version valueorg.hibernate.cache.CacheException - Propagated from underlying Regionpublic org.hibernate.cache.access.SoftLock lockItem(Object key, Object version) throws org.hibernate.cache.CacheException
AccessDelegateThe returned object must be passed back to release(), to release the lock. Concurrency strategies which do not support client-visible locks may silently return null.
lockItem in interface AccessDelegate<T extends HazelcastRegion>lockItem in class NonStrictReadWriteAccessDelegate<T extends HazelcastRegion>key - The key of the item to lockversion - The item's current version valueorg.hibernate.cache.CacheException - Propagated from underlying Regionpublic org.hibernate.cache.access.SoftLock lockRegion()
throws org.hibernate.cache.CacheException
AbstractAccessDelegatelockRegion in interface AccessDelegate<T extends HazelcastRegion>lockRegion in class AbstractAccessDelegate<T extends HazelcastRegion>UnsupportedOperationException - Thrown always because a read-only cache region cannot be lockedorg.hibernate.cache.CacheException - Propagated from underlying Regionpublic void removeAll()
throws org.hibernate.cache.CacheException
AccessDelegateremoveAll in interface AccessDelegate<T extends HazelcastRegion>removeAll in class NonStrictReadWriteAccessDelegate<T extends HazelcastRegion>org.hibernate.cache.CacheException - Propagated from underlying Regionpublic void unlockItem(Object key, org.hibernate.cache.access.SoftLock lock) throws org.hibernate.cache.CacheException
Should be a no-op since this cache is read-only
unlockItem in interface AccessDelegate<T extends HazelcastRegion>unlockItem in class NonStrictReadWriteAccessDelegate<T extends HazelcastRegion>key - The item keylock - The lock previously obtained from AccessDelegate.lockItem(java.lang.Object, java.lang.Object)org.hibernate.cache.CacheException - Propagated from underlying Regionpublic void unlockRegion(org.hibernate.cache.access.SoftLock lock)
throws org.hibernate.cache.CacheException
unlockRegion in interface AccessDelegate<T extends HazelcastRegion>unlockRegion in class AbstractAccessDelegate<T extends HazelcastRegion>lock - The lock previously obtained from AccessDelegate.lockRegion()org.hibernate.cache.CacheException - Propagated from underlying Regionpublic boolean update(Object key, Object value, Object currentVersion, Object previousVersion) throws org.hibernate.cache.CacheException
NonStrictReadWriteAccessDelegateRemoves the entry since this is a non-strict read/write cache strategy.
update in interface AccessDelegate<T extends HazelcastRegion>update in class NonStrictReadWriteAccessDelegate<T extends HazelcastRegion>key - The item keyvalue - The itemcurrentVersion - The item's current version valuepreviousVersion - The item's previous version valueUnsupportedOperationException - Thrown always because update is not possible on a read-only cacheorg.hibernate.cache.CacheException - Propagated from underlying RegionCopyright © 2018. All Rights Reserved.