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

pack-priv abstract Class AbstractEhcacheRegionFactory

extends Object
implements RegionFactory
Class Inheritance
All Implemented Interfaces
org.hibernate.cache.RegionFactory
Known Direct Subclasses
net.sf.ehcache.hibernate.EhCacheRegionFactory, net.sf.ehcache.hibernate.SingletonEhCacheRegionFactory
Imports
java.net.URL, java.util.Properties, net.sf.ehcache.CacheManager, .Ehcache, net.sf.ehcache.hibernate.management.impl.ProviderMBeanRegistrationHelper, net.sf.ehcache.hibernate.nonstop.NonstopAccessStrategyFactory, net.sf.ehcache.hibernate.regions.EhcacheQueryResultsRegion, .EhcacheTimestampsRegion, .EhcacheEntityRegion, .EhcacheCollectionRegion, net.sf.ehcache.hibernate.strategy.EhcacheAccessStrategyFactory, .EhcacheAccessStrategyFactoryImpl, net.sf.ehcache.util.Timestamper, org.hibernate.cache.CacheDataDescription, .CacheException, .CollectionRegion, .EntityRegion, .QueryResultsRegion, .RegionFactory, .TimestampsRegion, org.hibernate.cache.access.AccessType, org.hibernate.cfg.Settings, org.slf4j.Logger, .LoggerFactory

Abstract implementation of an Ehcache specific RegionFactory.
Authors
Chris Dennis, Greg Luck, Emmanuel Bernard, Abhishek Sanoujam

Field Summary

Modifier and TypeField and Description
protected final EhcacheAccessStrategyFactory
accessStrategyFactory

EhcacheAccessStrategyFactory for creating various access strategies

private static final Logger
protected volatile CacheManager
manager

Ehcache CacheManager that supplied Ehcache instances for this Hibernate RegionFactory.

protected final ProviderMBeanRegistrationHelper
mbeanRegistrationHelper

MBean registration helper class instance for Ehcache Hibernate MBeans.

public static final String
NET_SF_EHCACHE_CACHE_MANAGER_NAME

The Hibernate system property specifying the name of the CacheManager being created.

public static final String
NET_SF_EHCACHE_CONFIGURATION_RESOURCE_NAME

The Hibernate system property specifying the location of the ehcache configuration file name.

protected Settings
settings

Settings object for the Hibernate persistence unit.

Constructor Summary

AccessConstructor and Description
pack-priv

Method Summary

Modifier and TypeMethod and Description
public CollectionRegion
buildCollectionRegion(String
The name of the region.
regionName
,
Properties
Configuration properties.
properties
,
CacheDataDescription
Information regarding the type of data to be cached
metadata
)

Implements org.hibernate.cache.RegionFactory.buildCollectionRegion.

Build a cache region specialized for storing collection data.
public EntityRegion
buildEntityRegion(String
The name of the region.
regionName
,
Properties
Configuration properties.
properties
,
CacheDataDescription
Information regarding the type of data to be cached
metadata
)

Implements org.hibernate.cache.RegionFactory.buildEntityRegion.

Build a cache region specialized for storing entity data.
public QueryResultsRegion
buildQueryResultsRegion(String
The name of the region.
regionName
,
Properties
Configuration properties.
properties
)

Implements org.hibernate.cache.RegionFactory.buildQueryResultsRegion.

Build a cache region specialized for storing query results
public TimestampsRegion
buildTimestampsRegion(String
The name of the region.
regionName
,
Properties
Configuration properties.
properties
)

Implements org.hibernate.cache.RegionFactory.buildTimestampsRegion.

Build a cache region specialized for storing update-timestamps data.
private Ehcache
public AccessType
getDefaultAccessType()

Implements org.hibernate.cache.RegionFactory.getDefaultAccessType.

Default access-type used when the configured using JPA 2.0 config.
public boolean

Returns:

true, optimize for minimal puts
isMinimalPutsEnabledByDefault
()

Implements org.hibernate.cache.RegionFactory.isMinimalPutsEnabledByDefault.

Whether to optimize for minimals puts or minimal gets.
protected static URL
loadResource(String configurationResourceName)

Load a resource from the classpath.

public long
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

accessStrategyFactoryback to summary
protected final EhcacheAccessStrategyFactory accessStrategyFactory

EhcacheAccessStrategyFactory for creating various access strategies

LOGback to summary
private static final Logger LOG
managerback to summary
protected volatile CacheManager manager

Ehcache CacheManager that supplied Ehcache instances for this Hibernate RegionFactory.

mbeanRegistrationHelperback to summary
protected final ProviderMBeanRegistrationHelper mbeanRegistrationHelper

MBean registration helper class instance for Ehcache Hibernate MBeans.

NET_SF_EHCACHE_CACHE_MANAGER_NAMEback to summary
public static final String NET_SF_EHCACHE_CACHE_MANAGER_NAME

The Hibernate system property specifying the name of the CacheManager being created.

If not set, it will either use the ehcache.xml to name the CacheManager, or fallback to default CacheManager naming.

NET_SF_EHCACHE_CONFIGURATION_RESOURCE_NAMEback to summary
public static final String NET_SF_EHCACHE_CONFIGURATION_RESOURCE_NAME

The Hibernate system property specifying the location of the ehcache configuration file name.

If not set, ehcache.xml will be looked for in the root of the classpath.

If set to say ehcache-1.xml, ehcache-1.xml will be looked for in the root of the classpath.

settingsback to summary
protected Settings settings

Settings object for the Hibernate persistence unit.

Constructor Detail

AbstractEhcacheRegionFactoryback to summary
pack-priv AbstractEhcacheRegionFactory()

Method Detail

buildCollectionRegionback to summary
public CollectionRegion buildCollectionRegion(String regionName, Properties properties, CacheDataDescription metadata) throws CacheException

Implements org.hibernate.cache.RegionFactory.buildCollectionRegion.

Doc from org.hibernate.cache.RegionFactory.buildCollectionRegion.

Build a cache region specialized for storing collection data.

Parameters
regionName:String

The name of the region.

properties:Properties

Configuration properties.

metadata:CacheDataDescription

Information regarding the type of data to be cached

Returns:CollectionRegion

The built region

Exceptions
CacheException:
Indicates problems building the region.
buildEntityRegionback to summary
public EntityRegion buildEntityRegion(String regionName, Properties properties, CacheDataDescription metadata) throws CacheException

Implements org.hibernate.cache.RegionFactory.buildEntityRegion.

Doc from org.hibernate.cache.RegionFactory.buildEntityRegion.

Build a cache region specialized for storing entity data.

Parameters
regionName:String

The name of the region.

properties:Properties

Configuration properties.

metadata:CacheDataDescription

Information regarding the type of data to be cached

Returns:EntityRegion

The built region

Exceptions
CacheException:
Indicates problems building the region.
buildQueryResultsRegionback to summary
public QueryResultsRegion buildQueryResultsRegion(String regionName, Properties properties) throws CacheException

Implements org.hibernate.cache.RegionFactory.buildQueryResultsRegion.

Doc from org.hibernate.cache.RegionFactory.buildQueryResultsRegion.

Build a cache region specialized for storing query results

Parameters
regionName:String

The name of the region.

properties:Properties

Configuration properties.

Returns:QueryResultsRegion

The built region

Exceptions
CacheException:
Indicates problems building the region.
buildTimestampsRegionback to summary
public TimestampsRegion buildTimestampsRegion(String regionName, Properties properties) throws CacheException

Implements org.hibernate.cache.RegionFactory.buildTimestampsRegion.

Doc from org.hibernate.cache.RegionFactory.buildTimestampsRegion.

Build a cache region specialized for storing update-timestamps data.

Parameters
regionName:String

The name of the region.

properties:Properties

Configuration properties.

Returns:TimestampsRegion

The built region

Exceptions
CacheException:
Indicates problems building the region.
getCacheback to summary
private Ehcache getCache(String name) throws CacheException
getDefaultAccessTypeback to summary
public AccessType getDefaultAccessType()

Implements org.hibernate.cache.RegionFactory.getDefaultAccessType.

Default access-type used when the configured using JPA 2.0 config. JPA 2.0 allows @Cacheable(true) to be attached to an entity without any access type or usage qualification.

We are conservative here in specifying AccessType#READ_WRITE so as to follow the mantra of "do no harm".

This is a Hibernate 3.5 method.

Returns:AccessType

Doc from org.hibernate.cache.RegionFactory.getDefaultAccessType.

This factory's default access type.

isMinimalPutsEnabledByDefaultback to summary
public boolean isMinimalPutsEnabledByDefault()

Implements org.hibernate.cache.RegionFactory.isMinimalPutsEnabledByDefault.

Whether to optimize for minimals puts or minimal gets.

Indicates whether when operating in non-strict read/write or read-only mode Hibernate should optimize the access patterns for minimal puts or minimal gets. In Ehcache we default to minimal puts since this should have minimal to no affect on unclustered users, and has great benefit for clustered users.

This setting can be overridden by setting the "hibernate.cache.use_minimal_puts" property in the Hibernate configuration.

Returns:boolean

true, optimize for minimal puts

loadResourceback to summary
protected static URL loadResource(String configurationResourceName)

Load a resource from the classpath.

nextTimestampback to summary
public long nextTimestamp()

Implements org.hibernate.cache.RegionFactory.nextTimestamp.

Doc from org.hibernate.cache.RegionFactory.nextTimestamp.

Generate a timestamp.

This is generally used for cache content locking/unlocking purposes depending upon the access-strategy being used.

Returns:long

The generated timestamp.