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

public Class EhcacheTransactionalDataRegion

extends EhcacheDataRegion
implements TransactionalDataRegion
Class Inheritance
All Implemented Interfaces
org.hibernate.cache.TransactionalDataRegion, org.hibernate.cache.Region
Known Direct Subclasses
net.sf.ehcache.hibernate.regions.EhcacheCollectionRegion, net.sf.ehcache.hibernate.regions.EhcacheEntityRegion
Imports
java.util.Properties, net.sf.ehcache.Ehcache, .Element, net.sf.ehcache.concurrent.CacheLockProvider, .LockType, .StripedReadWriteLockSync, net.sf.ehcache.constructs.nonstop.NonStopCacheException, net.sf.ehcache.hibernate.nonstop.HibernateNonstopCacheExceptionHandler, net.sf.ehcache.hibernate.strategy.EhcacheAccessStrategyFactory, org.hibernate.cache.CacheDataDescription, .CacheException, .TransactionalDataRegion, org.hibernate.cfg.Settings

An Ehcache specific TransactionalDataRegion.

This is the common superclass entity and collection regions.

Authors
Chris Dennis, Greg Luck, Emmanuel Bernard, Abhishek Sanoujam

Field Summary

Modifier and TypeField and Description
private static final int
private final CacheLockProvider
protected final CacheDataDescription
metadata

Metadata associated with the objects stored in the region.

protected final Settings
settings

Hibernate settings associated with the persistence unit.

Inherited from net.sf.ehcache.hibernate.regions.EhcacheDataRegion:
accessStrategyFactorycache

Constructor Summary

AccessConstructor and Description
pack-priv
EhcacheTransactionalDataRegion(EhcacheAccessStrategyFactory accessStrategyFactory, Ehcache cache, Settings settings, CacheDataDescription metadata, Properties properties)

Construct an transactional Hibernate cache region around the given Ehcache instance.

Method Summary

Modifier and TypeMethod and Description
public final void
clear()

Remove all mapping from this cache region.

public final Object
get(Object key)

Get the value mapped to this key, or null if no value is mapped to this key.

public CacheDataDescription
public Settings

Returns:

settings
getSettings
()

Return the hibernate settings

public boolean
isTransactionAware()

Implements org.hibernate.cache.TransactionalDataRegion.isTransactionAware.

Is the underlying cache implementation aware of (and "participating in") ongoing JTA transactions?
public final boolean
locksAreIndependentOfCache()

Returns true if the locks used by the locking methods of this region are the independent of the cache.

public final void
put(Object key, Object value)

Map the given value to the given key, replacing any existing mapping for this key this unpins the key in the cache should it be currently pinned

private void
put(Object key, Object value, boolean eternal)

public final void
putEternal(Object key, Object value)

Map the given value to the given key, replacing any existing mapping for this key, pinning the key in the cache

public final void
readLock(Object key)

Attempts to read lock the mapping for the given key.

public final void
readUnlock(Object key)

Attempts to read unlock the mapping for the given key.

public final void
remove(Object key)

Remove the mapping for this key (if any exists).

public final void
writeLock(Object key)

Attempts to write lock the mapping for the given key.

public final void
writeUnlock(Object key)

Attempts to write unlock the mapping for the given key.

Inherited from net.sf.ehcache.hibernate.regions.EhcacheDataRegion:
containsdestroygetEhcachegetElementCountInMemorygetElementCountOnDiskgetNamegetSizeInMemorygetTimeoutnextTimestamptoMap

Field Detail

LOCAL_LOCK_PROVIDER_CONCURRENCYback to summary
private static final int LOCAL_LOCK_PROVIDER_CONCURRENCY
lockProviderback to summary
private final CacheLockProvider lockProvider
metadataback to summary
protected final CacheDataDescription metadata

Metadata associated with the objects stored in the region.

settingsback to summary
protected final Settings settings

Hibernate settings associated with the persistence unit.

Constructor Detail

EhcacheTransactionalDataRegionback to summary
pack-priv EhcacheTransactionalDataRegion(EhcacheAccessStrategyFactory accessStrategyFactory, Ehcache cache, Settings settings, CacheDataDescription metadata, Properties properties)

Construct an transactional Hibernate cache region around the given Ehcache instance.

Method Detail

clearback to summary
public final void clear() throws CacheException

Remove all mapping from this cache region.

getback to summary
public final Object get(Object key)

Get the value mapped to this key, or null if no value is mapped to this key.

getCacheDataDescriptionback to summary
public CacheDataDescription getCacheDataDescription()

Implements org.hibernate.cache.TransactionalDataRegion.getCacheDataDescription.

getSettingsback to summary
public Settings getSettings()

Return the hibernate settings

Returns:Settings

settings

isTransactionAwareback to summary
public boolean isTransactionAware()

Implements org.hibernate.cache.TransactionalDataRegion.isTransactionAware.

Doc from org.hibernate.cache.TransactionalDataRegion.isTransactionAware.

Is the underlying cache implementation aware of (and "participating in") ongoing JTA transactions?

Regions which report that they are transaction-aware are considered "synchronous", in that we assume we can immediately (i.e. synchronously) write the changes to the cache and that the cache will properly manage application of the written changes within the bounds of ongoing JTA transactions. Conversely, regions reporting false are considered "asynchronous", where it is assumed that changes must be manually delayed by Hibernate until we are certain that the current transaction is successful (i.e. maintaining READ_COMMITTED isolation).

Returns:boolean

True if transaction aware; false otherwise.

locksAreIndependentOfCacheback to summary
public final boolean locksAreIndependentOfCache()

Returns true if the locks used by the locking methods of this region are the independent of the cache.

Independent locks are not locked by the cache when the cache is accessed directly. This means that for an independent lock lock holds taken through a region method will not block direct access to the cache via other means.

putback to summary
public final void put(Object key, Object value) throws CacheException

Map the given value to the given key, replacing any existing mapping for this key this unpins the key in the cache should it be currently pinned

putback to summary
private void put(Object key, Object value, boolean eternal) throws CacheException
putEternalback to summary
public final void putEternal(Object key, Object value) throws CacheException

Map the given value to the given key, replacing any existing mapping for this key, pinning the key in the cache

readLockback to summary
public final void readLock(Object key)

Attempts to read lock the mapping for the given key.

readUnlockback to summary
public final void readUnlock(Object key)

Attempts to read unlock the mapping for the given key.

removeback to summary
public final void remove(Object key) throws CacheException

Remove the mapping for this key (if any exists).

writeLockback to summary
public final void writeLock(Object key)

Attempts to write lock the mapping for the given key.

writeUnlockback to summary
public final void writeUnlock(Object key)

Attempts to write unlock the mapping for the given key.