Prev Class | Next Class | Frames | No Frames |
Summary: Nested | Field | Method | Constr | Detail: Nested | Field | Method | Constr |
java.lang.Object
org.hibernate.cache.impl.bridge.EntityAccessStrategyAdapter
public class EntityAccessStrategyAdapter
extends java.lang.Object
implements EntityRegionAccessStrategy
EntityRegionAccessStrategy
to CacheConcurrencyStrategy
.
Constructor Summary | |
|
Method Summary | |
boolean |
|
boolean |
|
void |
|
void |
|
void |
|
Object |
|
EntityRegion |
|
boolean |
|
SoftLock |
|
SoftLock |
|
boolean |
|
boolean |
|
void |
|
void |
|
void |
|
void |
|
boolean |
|
public EntityAccessStrategyAdapter(EntityRegion region, CacheConcurrencyStrategy ccs, Settings settings)
public boolean afterInsert(Object key, Object value, Object version) throws CacheException
Called after an item has been inserted (after the transaction completes), instead of calling release(). This method is used by "asynchronous" concurrency strategies.
- Specified by:
- afterInsert in interface EntityRegionAccessStrategy
- 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
public boolean afterUpdate(Object key, Object value, Object currentVersion, Object previousVersion, SoftLock lock) throws CacheException
Called after an item has been updated (after the transaction completes), instead of calling release(). This method is used by "asynchronous" concurrency strategies.
- Specified by:
- afterUpdate in interface EntityRegionAccessStrategy
- 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(Object,Object)
- Returns:
- Were the contents of the cache actual changed by this operation?
- Throws:
CacheException
- Propogated from underlyingRegion
public void destroy()
public void evict(Object key) throws CacheException
Forcibly evict an item from the cache immediately without regard for transaction isolation.
- Specified by:
- evict in interface EntityRegionAccessStrategy
- Parameters:
key
- The key of the item to remove
- Throws:
CacheException
- Propogated from underlyingRegion
public void evictAll() throws CacheException
Forcibly evict all items from the cache immediately without regard for transaction isolation.
- Specified by:
- evictAll in interface EntityRegionAccessStrategy
- Throws:
CacheException
- Propogated from underlyingRegion
public Object get(Object key, long txTimestamp) throws CacheException
Attempt to retrieve an object from the cache. Mainly used in attempting to resolve entities/collections from the second level cache.
- Specified by:
- get in interface EntityRegionAccessStrategy
- 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
public EntityRegion getRegion()
Get the wrapped entity cache region
- Specified by:
- getRegion in interface EntityRegionAccessStrategy
- Returns:
- The underlying region
public boolean insert(Object key, Object value, Object version) throws CacheException
Called after an item has been inserted (before the transaction completes), instead of calling evict(). This method is used by "synchronous" concurrency strategies.
- Specified by:
- insert in interface EntityRegionAccessStrategy
- 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
public SoftLock lockItem(Object key, Object version) throws CacheException
We 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:
- lockItem in interface EntityRegionAccessStrategy
- 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
public SoftLock lockRegion() throws CacheException
Lock the entire region
- Specified by:
- lockRegion in interface EntityRegionAccessStrategy
- Returns:
- A representation of our lock on the item; or null.
- Throws:
CacheException
- Propogated from underlyingRegion
public boolean putFromLoad(Object key, Object value, long txTimestamp, Object version) throws CacheException
Attempt to cache an object, after loading from the database.
- Specified by:
- putFromLoad in interface EntityRegionAccessStrategy
- 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
public boolean putFromLoad(Object key, Object value, long txTimestamp, Object version, boolean minimalPutOverride) throws CacheException
Attempt to cache an object, after loading from the database, explicitly specifying the minimalPut behavior.
- Specified by:
- putFromLoad in interface EntityRegionAccessStrategy
- 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
public void remove(Object key) throws CacheException
Called after an item has become stale (before the transaction completes). This method is used by "synchronous" concurrency strategies.
- Specified by:
- remove in interface EntityRegionAccessStrategy
- Parameters:
key
- The key of the item to remove
- Throws:
CacheException
- Propogated from underlyingRegion
public void removeAll() throws CacheException
Called to evict data from the entire region
- Specified by:
- removeAll in interface EntityRegionAccessStrategy
- Throws:
CacheException
- Propogated from underlyingRegion
public void unlockItem(Object key, SoftLock lock) throws CacheException
Called 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:
- unlockItem in interface EntityRegionAccessStrategy
- Parameters:
key
- The item keylock
- The lock previously obtained fromEntityRegionAccessStrategy.lockItem(Object,Object)
- Throws:
CacheException
- Propogated from underlyingRegion
public void unlockRegion(SoftLock lock) throws CacheException
Called after we have finished the attempted invalidation of the entire region
- Specified by:
- unlockRegion in interface EntityRegionAccessStrategy
- Parameters:
lock
- The lock previously obtained fromEntityRegionAccessStrategy.lockRegion()
- Throws:
CacheException
- Propogated from underlyingRegion
public boolean update(Object key, Object value, Object currentVersion, Object previousVersion) throws CacheException
Called after an item has been updated (before the transaction completes), instead of calling evict(). This method is used by "synchronous" concurrency strategies.
- Specified by:
- update in interface EntityRegionAccessStrategy
- 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