public class SingletonEhCacheRegionFactory extends Object
Modifier and Type | Field and Description |
---|---|
protected EhcacheAccessStrategyFactory |
accessStrategyFactory
EhcacheAccessStrategyFactory for creating various access strategies |
protected net.sf.ehcache.CacheManager |
manager
Ehcache CacheManager that supplied Ehcache instances for this Hibernate RegionFactory.
|
protected ProviderMBeanRegistrationHelper |
mbeanRegistrationHelper
MBean registration helper class instance for Ehcache Hibernate MBeans.
|
static 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 and Description |
---|
SingletonEhCacheRegionFactory()
Constructs a SingletonEhCacheRegionFactory
|
SingletonEhCacheRegionFactory(Properties prop)
Constructs a SingletonEhCacheRegionFactory
|
Modifier and Type | Method and Description |
---|---|
CollectionRegion |
buildCollectionRegion(String regionName,
Properties properties,
CacheDataDescription metadata)
Build a cache region specialized for storing collection data.
|
EntityRegion |
buildEntityRegion(String regionName,
Properties properties,
CacheDataDescription metadata)
Build a cache region specialized for storing entity data.
|
NaturalIdRegion |
buildNaturalIdRegion(String regionName,
Properties properties,
CacheDataDescription metadata)
Build a cache region specialized for storing NaturalId to Primary Key mappings.
|
QueryResultsRegion |
buildQueryResultsRegion(String regionName,
Properties properties)
Build a cache region specialized for storing query results.
|
TimestampsRegion |
buildTimestampsRegion(String regionName,
Properties properties)
Build a cache region specialized for storing update-timestamps data.
|
AccessType |
getDefaultAccessType()
Default access-type used when the configured using JPA 2.0 config.
|
boolean |
isMinimalPutsEnabledByDefault()
By default should we perform "minimal puts" when using this second
level cache implementation?
|
protected URL |
loadResource(String configurationResourceName)
Load a resource from the classpath.
|
long |
nextTimestamp()
Generate a timestamp.
|
void |
setClassLoaderService(ClassLoaderService classLoaderService) |
void |
start(Settings settings,
Properties properties)
Lifecycle callback to perform any necessary initialization of the
underlying cache implementation(s).
|
void |
stop()
Lifecycle callback to perform any necessary cleanup of the underlying
cache implementation(s).
|
public static final String NET_SF_EHCACHE_CONFIGURATION_RESOURCE_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.
protected final ProviderMBeanRegistrationHelper mbeanRegistrationHelper
protected volatile net.sf.ehcache.CacheManager manager
protected Settings settings
protected final EhcacheAccessStrategyFactory accessStrategyFactory
EhcacheAccessStrategyFactory
for creating various access strategiespublic SingletonEhCacheRegionFactory()
public SingletonEhCacheRegionFactory(Properties prop)
prop
- Not usedpublic void start(Settings settings, Properties properties) throws CacheException
RegionFactory
SessionFactoryImpl
.settings
- The settings in effect.properties
- The defined cfg propertiesCacheException
- Indicates problems starting the L2 cache impl;
considered as a sign to stop SessionFactory
building.public void stop()
RegionFactory
SessionFactory.close()
.public boolean isMinimalPutsEnabledByDefault()
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.
isMinimalPutsEnabledByDefault
in interface RegionFactory
public long nextTimestamp()
RegionFactory
This is generally used for cache content locking/unlocking purposes depending upon the access-strategy being used.
nextTimestamp
in interface RegionFactory
public EntityRegion buildEntityRegion(String regionName, Properties properties, CacheDataDescription metadata) throws CacheException
RegionFactory
buildEntityRegion
in interface RegionFactory
regionName
- The name of the region.properties
- Configuration properties.metadata
- Information regarding the type of data to be cachedCacheException
- Indicates problems building the region.public NaturalIdRegion buildNaturalIdRegion(String regionName, Properties properties, CacheDataDescription metadata) throws CacheException
RegionFactory
buildNaturalIdRegion
in interface RegionFactory
regionName
- The name of the region.properties
- Configuration properties.metadata
- Information regarding the type of data to be cachedCacheException
- Indicates problems building the region.public CollectionRegion buildCollectionRegion(String regionName, Properties properties, CacheDataDescription metadata) throws CacheException
RegionFactory
buildCollectionRegion
in interface RegionFactory
regionName
- The name of the region.properties
- Configuration properties.metadata
- Information regarding the type of data to be cachedCacheException
- Indicates problems building the region.public QueryResultsRegion buildQueryResultsRegion(String regionName, Properties properties) throws CacheException
RegionFactory
buildQueryResultsRegion
in interface RegionFactory
regionName
- The name of the region.properties
- Configuration properties.CacheException
- Indicates problems building the region.public void setClassLoaderService(ClassLoaderService classLoaderService)
public TimestampsRegion buildTimestampsRegion(String regionName, Properties properties) throws CacheException
RegionFactory
buildTimestampsRegion
in interface RegionFactory
regionName
- The name of the region.properties
- Configuration properties.CacheException
- Indicates problems building the region.protected URL loadResource(String configurationResourceName)
public AccessType getDefaultAccessType()
@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.
getDefaultAccessType
in interface RegionFactory
Copyright © 2001-2015 Red Hat, Inc. All Rights Reserved.