Top Description Constructors Methods
net.sf.ehcache.hibernate.strategy

public Class ReadWriteEhcacheEntityRegionAccessStrategy

extends AbstractReadWriteEhcacheAccessStrategy<EhcacheEntityRegion>
implements EntityRegionAccessStrategy
Class Inheritance
All Implemented Interfaces
org.hibernate.cache.access.EntityRegionAccessStrategy
Imports
net.sf.ehcache.hibernate.regions.EhcacheEntityRegion, org.hibernate.cache.CacheException, .EntityRegion, org.hibernate.cache.access.EntityRegionAccessStrategy, .SoftLock, org.hibernate.cfg.Settings

Ehcache specific read/write entity region access strategy
Author
Chris Dennis

Constructor Summary

AccessConstructor and Description
public
ReadWriteEhcacheEntityRegionAccessStrategy(EhcacheEntityRegion region, Settings settings)

Create a read/write access strategy accessing the given entity region.

Method Summary

Modifier and TypeMethod and Description
public boolean
afterInsert(Object
The item key
key
,
Object
The item
value
,
Object
The item's version value
version
)

Implements org.hibernate.cache.access.EntityRegionAccessStrategy.afterInsert.

Called after an item has been inserted (after the transaction completes), instead of calling release().
public boolean
afterUpdate(Object
The item key
key
,
Object
The item
value
,
Object
The item's current version value
currentVersion
,
Object
The item's previous version value
previousVersion
,
SoftLock
The lock previously obtained from lockItem
lock
)

Implements org.hibernate.cache.access.EntityRegionAccessStrategy.afterUpdate.

Called after an item has been updated (after the transaction completes), instead of calling release().
public EntityRegion
getRegion()

Implements org.hibernate.cache.access.EntityRegionAccessStrategy.getRegion.

Get the wrapped entity cache region
public boolean
insert(Object
The item key
key
,
Object
The item
value
,
Object
The item's version value
version
)

Implements org.hibernate.cache.access.EntityRegionAccessStrategy.insert.

A no-op since this is an asynchronous cache access strategy.
public boolean
update(Object
The item key
key
,
Object
The item
value
,
Object
The item's current version value
currentVersion
,
Object
The item's previous version value
previousVersion
)

Implements org.hibernate.cache.access.EntityRegionAccessStrategy.update.

A no-op since this is an asynchronous cache access strategy.
Inherited from net.sf.ehcache.hibernate.strategy.AbstractReadWriteEhcacheAccessStrategy:
decrementLockgethandleMissingLocklockItemputFromLoadunlockItem

Constructor Detail

ReadWriteEhcacheEntityRegionAccessStrategyback to summary
public ReadWriteEhcacheEntityRegionAccessStrategy(EhcacheEntityRegion region, Settings settings)

Create a read/write access strategy accessing the given entity region.

Method Detail

afterInsertback to summary
public boolean afterInsert(Object key, Object value, Object version) throws CacheException

Implements org.hibernate.cache.access.EntityRegionAccessStrategy.afterInsert.

Doc from org.hibernate.cache.access.EntityRegionAccessStrategy.afterInsert.

Called after an item has been inserted (after the transaction completes), instead of calling release(). This method is used by "asynchronous" concurrency strategies.

Inserts will only succeed if there is no existing value mapped to this key.

Parameters
key:Object

The item key

value:Object

The item

version:Object

The item's version value

Returns:boolean

Were the contents of the cache actual changed by this operation?

Exceptions
CacheException:
Propogated from underlying org.hibernate.cache.Region
afterUpdateback to summary
public boolean afterUpdate(Object key, Object value, Object currentVersion, Object previousVersion, SoftLock lock) throws CacheException

Implements org.hibernate.cache.access.EntityRegionAccessStrategy.afterUpdate.

Doc from org.hibernate.cache.access.EntityRegionAccessStrategy.afterUpdate.

Called after an item has been updated (after the transaction completes), instead of calling release(). This method is used by "asynchronous" concurrency strategies.

Updates will only succeed if this entry was locked by this transaction and exclusively this transaction for the duration of this transaction. It is important to also note that updates will fail if the soft-lock expired during the course of this transaction.

Parameters
key:Object

The item key

value:Object

The item

currentVersion:Object

The item's current version value

previousVersion:Object

The item's previous version value

lock:SoftLock

The lock previously obtained from lockItem

Returns:boolean

Were the contents of the cache actual changed by this operation?

Exceptions
CacheException:
Propogated from underlying org.hibernate.cache.Region
getRegionback to summary
public EntityRegion getRegion()

Implements org.hibernate.cache.access.EntityRegionAccessStrategy.getRegion.

Doc from org.hibernate.cache.access.EntityRegionAccessStrategy.getRegion.

Get the wrapped entity cache region

Returns:EntityRegion

The underlying region

insertback to summary
public boolean insert(Object key, Object value, Object version) throws CacheException

Implements org.hibernate.cache.access.EntityRegionAccessStrategy.insert.

A no-op since this is an asynchronous cache access strategy.

Parameters
key:Object

Doc from org.hibernate.cache.access.EntityRegionAccessStrategy.insert.

The item key

value:Object

Doc from org.hibernate.cache.access.EntityRegionAccessStrategy.insert.

The item

version:Object

Doc from org.hibernate.cache.access.EntityRegionAccessStrategy.insert.

The item's version value

Returns:boolean

Doc from org.hibernate.cache.access.EntityRegionAccessStrategy.insert.

Were the contents of the cache actual changed by this operation?

Exceptions
CacheException:

Doc from org.hibernate.cache.access.EntityRegionAccessStrategy.insert.

Propogated from underlying org.hibernate.cache.Region

updateback to summary
public boolean update(Object key, Object value, Object currentVersion, Object previousVersion) throws CacheException

Implements org.hibernate.cache.access.EntityRegionAccessStrategy.update.

A no-op since this is an asynchronous cache access strategy.

Parameters
key:Object

Doc from org.hibernate.cache.access.EntityRegionAccessStrategy.update.

The item key

value:Object

Doc from org.hibernate.cache.access.EntityRegionAccessStrategy.update.

The item

currentVersion:Object

Doc from org.hibernate.cache.access.EntityRegionAccessStrategy.update.

The item's current version value

previousVersion:Object

Doc from org.hibernate.cache.access.EntityRegionAccessStrategy.update.

The item's previous version value

Returns:boolean

Doc from org.hibernate.cache.access.EntityRegionAccessStrategy.update.

Were the contents of the cache actual changed by this operation?

Exceptions
CacheException:

Doc from org.hibernate.cache.access.EntityRegionAccessStrategy.update.

Propogated from underlying org.hibernate.cache.Region