Class InvalidationCacheAccessDelegate
java.lang.Object
org.infinispan.hibernate.cache.commons.access.InvalidationCacheAccessDelegate
- All Implemented Interfaces:
AccessDelegate
- Direct Known Subclasses:
NonTxInvalidationCacheAccessDelegate,TxInvalidationCacheAccessDelegate
- Since:
- 3.5
- Author:
- Brian Stansberry, Galder ZamarreƱo
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected final org.infinispan.AdvancedCacheprotected static final InfinispanMessageLoggerprotected final PutFromLoadValidatorprotected final InfinispanDataRegion -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedInvalidationCacheAccessDelegate(InfinispanDataRegion region, PutFromLoadValidator validator) Create a new transactional access delegate instance. -
Method Summary
Modifier and TypeMethodDescriptionvoidForcibly 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.voidlockAll()Called just before the delegate will have all entries removed.booleanputFromLoad(Object session, Object key, Object value, long txTimestamp, Object version) Attempt to cache an object, after loading from the database.booleanputFromLoad(Object session, 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 regionvoidCalled just after the delegate had all entries removed viaAccessDelegate.removeAll().voidunlockItem(Object session, Object key) Called when we have finished the attempted update/delete (which may or may not have been successful), after transaction completion.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.infinispan.hibernate.cache.commons.access.AccessDelegate
afterInsert, afterUpdate, insert, update
-
Field Details
-
log
-
cache
protected final org.infinispan.AdvancedCache cache -
region
-
putValidator
-
writeCache
-
-
Constructor Details
-
InvalidationCacheAccessDelegate
protected InvalidationCacheAccessDelegate(InfinispanDataRegion region, PutFromLoadValidator validator) Create a new transactional access delegate instance.- Parameters:
region- to control access tovalidator- put from load validator
-
-
Method Details
-
get
public Object get(Object session, Object key, long txTimestamp) throws org.hibernate.cache.CacheException Attempt to retrieve an object from the cache.- Specified by:
getin interfaceAccessDelegate- Parameters:
session-key- The key of the item to be retrievedtxTimestamp- a timestamp prior to the transaction start time- Returns:
- the cached object or null
- Throws:
org.hibernate.cache.CacheException- if the cache retrieval failed
-
putFromLoad
public boolean putFromLoad(Object session, Object key, Object value, long txTimestamp, Object version) Description copied from interface:AccessDelegateAttempt to cache an object, after loading from the database.- Specified by:
putFromLoadin interfaceAccessDelegate- Parameters:
session- Current sessionkey- 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
-
putFromLoad
public boolean putFromLoad(Object session, Object key, Object value, long txTimestamp, Object version, boolean minimalPutOverride) throws org.hibernate.cache.CacheException Attempt to cache an object, after loading from the database, explicitly specifying the minimalPut behavior.- Specified by:
putFromLoadin interfaceAccessDelegate- Parameters:
session- Current sessionkey- 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:
org.hibernate.cache.CacheException- if storing the object failed
-
remove
Description copied from interface:AccessDelegateCalled after an item has become stale (before the transaction completes).- Specified by:
removein interfaceAccessDelegate- Parameters:
session- Current sessionkey- The key of the item to remove- Throws:
org.hibernate.cache.CacheException- if removing the cached item fails
-
lockAll
public void lockAll() throws org.hibernate.cache.CacheExceptionDescription copied from interface:AccessDelegateCalled just before the delegate will have all entries removed. Any work to prevent concurrent modifications while this occurs should happen here- Specified by:
lockAllin interfaceAccessDelegate- Throws:
org.hibernate.cache.CacheException- if locking had an issue
-
unlockAll
public void unlockAll() throws org.hibernate.cache.CacheExceptionDescription copied from interface:AccessDelegateCalled just after the delegate had all entries removed viaAccessDelegate.removeAll(). Any work required to allow for new modifications to happen should be done here- Specified by:
unlockAllin interfaceAccessDelegate- Throws:
org.hibernate.cache.CacheException- if unlocking had an issue
-
removeAll
public void removeAll() throws org.hibernate.cache.CacheExceptionDescription copied from interface:AccessDelegateCalled to evict data from the entire region- Specified by:
removeAllin interfaceAccessDelegate- Throws:
org.hibernate.cache.CacheException- if eviction the region fails
-
evict
Description copied from interface:AccessDelegateForcibly evict an item from the cache immediately without regard for transaction isolation.- Specified by:
evictin interfaceAccessDelegate- Parameters:
key- The key of the item to remove- Throws:
org.hibernate.cache.CacheException- if evicting the item fails
-
evictAll
public void evictAll() throws org.hibernate.cache.CacheExceptionDescription copied from interface:AccessDelegateForcibly evict all items from the cache immediately without regard for transaction isolation.- Specified by:
evictAllin interfaceAccessDelegate- Throws:
org.hibernate.cache.CacheException- if evicting items fails
-
unlockItem
Description copied from interface:AccessDelegateCalled 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 interfaceAccessDelegatekey- The item key- Throws:
org.hibernate.cache.CacheException- Propogated from underlyingRegion
-