Package org.hibernate.cache.impl.bridge
Class CollectionAccessStrategyAdapter
java.lang.Object
org.hibernate.cache.impl.bridge.CollectionAccessStrategyAdapter
- All Implemented Interfaces:
CollectionRegionAccessStrategy
public class CollectionAccessStrategyAdapter
extends Object
implements CollectionRegionAccessStrategy
Adapter specifically bridging
CollectionRegionAccessStrategy to CacheConcurrencyStrategy.-
Constructor Summary
ConstructorsConstructorDescriptionCollectionAccessStrategyAdapter(CollectionRegion region, CacheConcurrencyStrategy ccs, Settings settings) -
Method Summary
Modifier and TypeMethodDescriptionvoiddestroy()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 collection cache regionWe 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 region
-
Constructor Details
-
CollectionAccessStrategyAdapter
public CollectionAccessStrategyAdapter(CollectionRegion region, CacheConcurrencyStrategy ccs, Settings settings)
-
-
Method Details
-
getRegion
Description copied from interface:CollectionRegionAccessStrategyGet the wrapped collection cache region- Specified by:
getRegionin interfaceCollectionRegionAccessStrategy- Returns:
- The underlying region
-
get
Description copied from interface:CollectionRegionAccessStrategyAttempt to retrieve an object from the cache. Mainly used in attempting to resolve entities/collections from the second level cache.- Specified by:
getin interfaceCollectionRegionAccessStrategy- 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:CollectionRegionAccessStrategyAttempt to cache an object, after loading from the database.- Specified by:
putFromLoadin interfaceCollectionRegionAccessStrategy- 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:CollectionRegionAccessStrategyAttempt to cache an object, after loading from the database, explicitly specifying the minimalPut behavior.- Specified by:
putFromLoadin interfaceCollectionRegionAccessStrategy- 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:CollectionRegionAccessStrategyWe 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 interfaceCollectionRegionAccessStrategy- 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:CollectionRegionAccessStrategyLock the entire region- Specified by:
lockRegionin interfaceCollectionRegionAccessStrategy- Returns:
- A representation of our lock on the item; or null.
- Throws:
CacheException- Propogated from underlyingRegion
-
unlockItem
Description copied from interface:CollectionRegionAccessStrategyCalled 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 interfaceCollectionRegionAccessStrategy- Parameters:
key- The item keylock- The lock previously obtained fromCollectionRegionAccessStrategy.lockItem(java.lang.Object, java.lang.Object)- Throws:
CacheException- Propogated from underlyingRegion
-
unlockRegion
Description copied from interface:CollectionRegionAccessStrategyCalled after we have finished the attempted invalidation of the entire region- Specified by:
unlockRegionin interfaceCollectionRegionAccessStrategy- Parameters:
lock- The lock previously obtained fromCollectionRegionAccessStrategy.lockRegion()- Throws:
CacheException- Propogated from underlyingRegion
-
remove
Description copied from interface:CollectionRegionAccessStrategyCalled after an item has become stale (before the transaction completes). This method is used by "synchronous" concurrency strategies.- Specified by:
removein interfaceCollectionRegionAccessStrategy- Parameters:
key- The key of the item to remove- Throws:
CacheException- Propogated from underlyingRegion
-
removeAll
Description copied from interface:CollectionRegionAccessStrategyCalled to evict data from the entire region- Specified by:
removeAllin interfaceCollectionRegionAccessStrategy- Throws:
CacheException- Propogated from underlyingRegion
-
evict
Description copied from interface:CollectionRegionAccessStrategyForcibly evict an item from the cache immediately without regard for transaction isolation.- Specified by:
evictin interfaceCollectionRegionAccessStrategy- Parameters:
key- The key of the item to remove- Throws:
CacheException- Propogated from underlyingRegion
-
evictAll
Description copied from interface:CollectionRegionAccessStrategyForcibly evict all items from the cache immediately without regard for transaction isolation.- Specified by:
evictAllin interfaceCollectionRegionAccessStrategy- Throws:
CacheException- Propogated from underlyingRegion
-
destroy
public void destroy()
-