Package org.hibernate.cache.impl.bridge
Class EntityAccessStrategyAdapter
java.lang.Object
org.hibernate.cache.impl.bridge.EntityAccessStrategyAdapter
- All Implemented Interfaces:
EntityRegionAccessStrategy
Adapter specifically bridging
EntityRegionAccessStrategy to CacheConcurrencyStrategy.-
Constructor Summary
ConstructorsConstructorDescriptionEntityAccessStrategyAdapter(EntityRegion region, CacheConcurrencyStrategy ccs, Settings settings) -
Method Summary
Modifier and TypeMethodDescriptionbooleanafterInsert(Object key, Object value, Object version) Called after an item has been inserted (after the transaction completes), instead of calling release().booleanCalled after an item has been updated (after the transaction completes), instead of calling release().voiddestroy()voidForcibly evict an item from the cache immediately without regard for transaction isolation.voidevictAll()Forcibly evict all items from the cache immediately without regard for transaction isolation.Attempt to retrieve an object from the cache.Get the wrapped entity cache regionbooleanCalled after an item has been inserted (before the transaction completes), instead of calling evict().We are going to attempt to update/delete the keyed object.Lock the entire regionbooleanputFromLoad(Object key, Object value, long txTimestamp, Object version) Attempt to cache an object, after loading from the database.booleanputFromLoad(Object key, Object value, long txTimestamp, Object version, boolean minimalPutOverride) Attempt to cache an object, after loading from the database, explicitly specifying the minimalPut behavior.voidCalled after an item has become stale (before the transaction completes).voidCalled to evict data from the entire regionvoidunlockItem(Object key, SoftLock lock) Called when we have finished the attempted update/delete (which may or may not have been successful), after transaction completion.voidunlockRegion(SoftLock lock) Called after we have finished the attempted invalidation of the entire regionbooleanCalled after an item has been updated (before the transaction completes), instead of calling evict().
-
Constructor Details
-
EntityAccessStrategyAdapter
public EntityAccessStrategyAdapter(EntityRegion region, CacheConcurrencyStrategy ccs, Settings settings)
-
-
Method Details
-
getRegion
Description copied from interface:EntityRegionAccessStrategyGet the wrapped entity cache region- Specified by:
getRegionin interfaceEntityRegionAccessStrategy- Returns:
- The underlying region
-
get
Description copied from interface:EntityRegionAccessStrategyAttempt to retrieve an object from the cache. Mainly used in attempting to resolve entities/collections from the second level cache.- Specified by:
getin interfaceEntityRegionAccessStrategy- Parameters:
key- The key of the item to be retrieved.txTimestamp- a timestamp prior to the transaction start time- Returns:
- the cached object or null
- Throws:
CacheException- Propogated from underlyingRegion
-
putFromLoad
public boolean putFromLoad(Object key, Object value, long txTimestamp, Object version) throws CacheException Description copied from interface:EntityRegionAccessStrategyAttempt to cache an object, after loading from the database.- Specified by:
putFromLoadin interfaceEntityRegionAccessStrategy- Parameters:
key- The item keyvalue- The itemtxTimestamp- a timestamp prior to the transaction start timeversion- the item version number- Returns:
- true if the object was successfully cached
- Throws:
CacheException- Propogated from underlyingRegion
-
putFromLoad
public boolean putFromLoad(Object key, Object value, long txTimestamp, Object version, boolean minimalPutOverride) throws CacheException Description copied from interface:EntityRegionAccessStrategyAttempt to cache an object, after loading from the database, explicitly specifying the minimalPut behavior.- Specified by:
putFromLoadin interfaceEntityRegionAccessStrategy- Parameters:
key- The item keyvalue- The itemtxTimestamp- a timestamp prior to the transaction start timeversion- the item version numberminimalPutOverride- Explicit minimalPut flag- Returns:
- true if the object was successfully cached
- Throws:
CacheException- Propogated from underlyingRegion
-
lockItem
Description copied from interface:EntityRegionAccessStrategyWe are going to attempt to update/delete the keyed object. This method is used by "asynchronous" concurrency strategies. The 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.- Specified by:
lockItemin interfaceEntityRegionAccessStrategy- Parameters:
key- The key of the item to lockversion- The item's current version value- Returns:
- A representation of our lock on the item; or null.
- Throws:
CacheException- Propogated from underlyingRegion
-
lockRegion
Description copied from interface:EntityRegionAccessStrategyLock the entire region- Specified by:
lockRegionin interfaceEntityRegionAccessStrategy- Returns:
- A representation of our lock on the item; or null.
- Throws:
CacheException- Propogated from underlyingRegion
-
unlockItem
Description copied from interface:EntityRegionAccessStrategyCalled when we have finished the attempted update/delete (which may or may not have been successful), after transaction completion. This method is used by "asynchronous" concurrency strategies.- Specified by:
unlockItemin interfaceEntityRegionAccessStrategy- Parameters:
key- The item keylock- The lock previously obtained fromEntityRegionAccessStrategy.lockItem(java.lang.Object, java.lang.Object)- Throws:
CacheException- Propogated from underlyingRegion
-
unlockRegion
Description copied from interface:EntityRegionAccessStrategyCalled after we have finished the attempted invalidation of the entire region- Specified by:
unlockRegionin interfaceEntityRegionAccessStrategy- Parameters:
lock- The lock previously obtained fromEntityRegionAccessStrategy.lockRegion()- Throws:
CacheException- Propogated from underlyingRegion
-
insert
Description copied from interface:EntityRegionAccessStrategyCalled after an item has been inserted (before the transaction completes), instead of calling evict(). This method is used by "synchronous" concurrency strategies.- Specified by:
insertin interfaceEntityRegionAccessStrategy- Parameters:
key- The item keyvalue- The itemversion- The item's version value- Returns:
- Were the contents of the cache actual changed by this operation?
- Throws:
CacheException- Propogated from underlyingRegion
-
afterInsert
Description copied from interface:EntityRegionAccessStrategyCalled after an item has been inserted (after the transaction completes), instead of calling release(). This method is used by "asynchronous" concurrency strategies.- Specified by:
afterInsertin interfaceEntityRegionAccessStrategy- Parameters:
key- The item keyvalue- The itemversion- The item's version value- Returns:
- Were the contents of the cache actual changed by this operation?
- Throws:
CacheException- Propogated from underlyingRegion
-
update
public boolean update(Object key, Object value, Object currentVersion, Object previousVersion) throws CacheException Description copied from interface:EntityRegionAccessStrategyCalled after an item has been updated (before the transaction completes), instead of calling evict(). This method is used by "synchronous" concurrency strategies.- Specified by:
updatein interfaceEntityRegionAccessStrategy- Parameters:
key- The item keyvalue- The itemcurrentVersion- The item's current version valuepreviousVersion- The item's previous version value- Returns:
- Were the contents of the cache actual changed by this operation?
- Throws:
CacheException- Propogated from underlyingRegion
-
afterUpdate
public boolean afterUpdate(Object key, Object value, Object currentVersion, Object previousVersion, SoftLock lock) throws CacheException Description copied from interface:EntityRegionAccessStrategyCalled after an item has been updated (after the transaction completes), instead of calling release(). This method is used by "asynchronous" concurrency strategies.- Specified by:
afterUpdatein interfaceEntityRegionAccessStrategy- Parameters:
key- The item keyvalue- The itemcurrentVersion- The item's current version valuepreviousVersion- The item's previous version valuelock- The lock previously obtained fromEntityRegionAccessStrategy.lockItem(java.lang.Object, java.lang.Object)- Returns:
- Were the contents of the cache actual changed by this operation?
- Throws:
CacheException- Propogated from underlyingRegion
-
remove
Description copied from interface:EntityRegionAccessStrategyCalled after an item has become stale (before the transaction completes). This method is used by "synchronous" concurrency strategies.- Specified by:
removein interfaceEntityRegionAccessStrategy- Parameters:
key- The key of the item to remove- Throws:
CacheException- Propogated from underlyingRegion
-
removeAll
Description copied from interface:EntityRegionAccessStrategyCalled to evict data from the entire region- Specified by:
removeAllin interfaceEntityRegionAccessStrategy- Throws:
CacheException- Propogated from underlyingRegion
-
evict
Description copied from interface:EntityRegionAccessStrategyForcibly evict an item from the cache immediately without regard for transaction isolation.- Specified by:
evictin interfaceEntityRegionAccessStrategy- Parameters:
key- The key of the item to remove- Throws:
CacheException- Propogated from underlyingRegion
-
evictAll
Description copied from interface:EntityRegionAccessStrategyForcibly evict all items from the cache immediately without regard for transaction isolation.- Specified by:
evictAllin interfaceEntityRegionAccessStrategy- Throws:
CacheException- Propogated from underlyingRegion
-
destroy
public void destroy()
-