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

public Class NonStrictReadWriteEhcacheCollectionRegionAccessStrategy

extends AbstractEhcacheAccessStrategy<EhcacheCollectionRegion>
implements CollectionRegionAccessStrategy
Class Inheritance
All Implemented Interfaces
org.hibernate.cache.access.CollectionRegionAccessStrategy
Imports
net.sf.ehcache.hibernate.regions.EhcacheCollectionRegion, org.hibernate.cache.CacheException, .CollectionRegion, org.hibernate.cache.access.CollectionRegionAccessStrategy, .SoftLock, org.hibernate.cfg.Settings

Ehcache specific non-strict read/write collection region access strategy
Author
Chris Dennis

Field Summary

Inherited from net.sf.ehcache.hibernate.strategy.AbstractEhcacheAccessStrategy:
regionsettings

Constructor Summary

AccessConstructor and Description
public
NonStrictReadWriteEhcacheCollectionRegionAccessStrategy(EhcacheCollectionRegion region, Settings settings)

Create a non-strict read/write access strategy accessing the given collection region.

Method Summary

Modifier and TypeMethod and Description
public Object
get(Object
The key of the item to be retrieved.
key
,
long
a timestamp prior to the transaction start time
txTimestamp
)

Implements org.hibernate.cache.access.CollectionRegionAccessStrategy.get.

Attempt to retrieve an object from the cache.
public CollectionRegion
getRegion()

Implements org.hibernate.cache.access.CollectionRegionAccessStrategy.getRegion.

Get the wrapped collection cache region
public SoftLock
lockItem(Object
The key of the item to lock
key
,
Object
The item's current version value
version
)

Implements org.hibernate.cache.access.CollectionRegionAccessStrategy.lockItem.

Since this is a non-strict read/write strategy item locking is not used.
public boolean
putFromLoad(Object
The item key
key
,
Object
The item
value
,
long
a timestamp prior to the transaction start time
txTimestamp
,
Object
the item version number
version
,
boolean
Explicit minimalPut flag
minimalPutOverride
)

Implements abstract net.sf.ehcache.hibernate.strategy.AbstractEhcacheAccessStrategy.putFromLoad.

Implements org.hibernate.cache.access.CollectionRegionAccessStrategy.putFromLoad.

Attempt to cache an object, after loading from the database, explicitly specifying the minimalPut behavior.
public void
remove(Object
The key of the item to remove
key
)

Overrides net.sf.ehcache.hibernate.strategy.AbstractEhcacheAccessStrategy.remove.

Implements org.hibernate.cache.access.CollectionRegionAccessStrategy.remove.

Called after an item has become stale (before the transaction completes).
public void
unlockItem(Object
The item key
key
,
SoftLock
The lock previously obtained from lockItem
lock
)

Implements org.hibernate.cache.access.CollectionRegionAccessStrategy.unlockItem.

Since this is a non-strict read/write strategy item locking is not used.
Inherited from net.sf.ehcache.hibernate.strategy.AbstractEhcacheAccessStrategy:
evictevictAlllockRegionputFromLoadremoveAllunlockRegion

Constructor Detail

NonStrictReadWriteEhcacheCollectionRegionAccessStrategyback to summary
public NonStrictReadWriteEhcacheCollectionRegionAccessStrategy(EhcacheCollectionRegion region, Settings settings)

Create a non-strict read/write access strategy accessing the given collection region.

Method Detail

getback to summary
public Object get(Object key, long txTimestamp) throws CacheException

Implements org.hibernate.cache.access.CollectionRegionAccessStrategy.get.

Doc from org.hibernate.cache.access.CollectionRegionAccessStrategy.get.

Attempt to retrieve an object from the cache. Mainly used in attempting to resolve entities/collections from the second level cache.

Parameters
key:Object

The key of the item to be retrieved.

txTimestamp:long

a timestamp prior to the transaction start time

Returns:Object

the cached object or null

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

Implements org.hibernate.cache.access.CollectionRegionAccessStrategy.getRegion.

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

Get the wrapped collection cache region

Returns:CollectionRegion

The underlying region

lockItemback to summary
public SoftLock lockItem(Object key, Object version) throws CacheException

Implements org.hibernate.cache.access.CollectionRegionAccessStrategy.lockItem.

Since this is a non-strict read/write strategy item locking is not used.

Parameters
key:Object

Doc from org.hibernate.cache.access.CollectionRegionAccessStrategy.lockItem.

The key of the item to lock

version:Object

Doc from org.hibernate.cache.access.CollectionRegionAccessStrategy.lockItem.

The item's current version value

Returns:SoftLock

Doc from org.hibernate.cache.access.CollectionRegionAccessStrategy.lockItem.

A representation of our lock on the item; or null.

Exceptions
CacheException:

Doc from org.hibernate.cache.access.CollectionRegionAccessStrategy.lockItem.

Propogated from underlying org.hibernate.cache.Region

putFromLoadback to summary
public boolean putFromLoad(Object key, Object value, long txTimestamp, Object version, boolean minimalPutOverride) throws CacheException

Implements abstract net.sf.ehcache.hibernate.strategy.AbstractEhcacheAccessStrategy.putFromLoad.

Implements org.hibernate.cache.access.CollectionRegionAccessStrategy.putFromLoad.

Doc from org.hibernate.cache.access.CollectionRegionAccessStrategy.putFromLoad.

Attempt to cache an object, after loading from the database, explicitly specifying the minimalPut behavior.

Parameters
key:Object

The item key

value:Object

The item

txTimestamp:long

a timestamp prior to the transaction start time

version:Object

the item version number

minimalPutOverride:boolean

Explicit minimalPut flag

Returns:boolean

true if the object was successfully cached

Exceptions
CacheException:
Propogated from underlying org.hibernate.cache.Region
removeback to summary
public void remove(Object key) throws CacheException

Overrides net.sf.ehcache.hibernate.strategy.AbstractEhcacheAccessStrategy.remove.

Implements org.hibernate.cache.access.CollectionRegionAccessStrategy.remove.

Doc from org.hibernate.cache.access.CollectionRegionAccessStrategy.remove.

Called after an item has become stale (before the transaction completes). This method is used by "synchronous" concurrency strategies.

Parameters
key:Object

The key of the item to remove

Annotations
@Override
Exceptions
CacheException:
Propogated from underlying org.hibernate.cache.Region
unlockItemback to summary
public void unlockItem(Object key, SoftLock lock) throws CacheException

Implements org.hibernate.cache.access.CollectionRegionAccessStrategy.unlockItem.

Since this is a non-strict read/write strategy item locking is not used.

Parameters
key:Object

Doc from org.hibernate.cache.access.CollectionRegionAccessStrategy.unlockItem.

The item key

lock:SoftLock

Doc from org.hibernate.cache.access.CollectionRegionAccessStrategy.unlockItem.

The lock previously obtained from lockItem

Exceptions
CacheException:

Doc from org.hibernate.cache.access.CollectionRegionAccessStrategy.unlockItem.

Propogated from underlying org.hibernate.cache.Region