Class EhCacheRegionFactory
- java.lang.Object
-
- org.hibernate.cache.spi.AbstractRegionFactory
-
- org.hibernate.cache.spi.support.RegionFactoryTemplate
-
- org.hibernate.cache.ehcache.internal.EhcacheRegionFactory
-
- org.onebusaway.container.spring.ehcache.EhCacheRegionFactory
-
- All Implemented Interfaces:
Serializable,org.hibernate.cache.spi.RegionFactory,org.hibernate.service.Service,org.hibernate.service.spi.Stoppable
public class EhCacheRegionFactory extends org.hibernate.cache.ehcache.internal.EhcacheRegionFactoryA Hibernate EhCacheRegionFactory implementation that supports directly setting theCacheManagerfrom an existing instance. This allows us to dynamically configure out CacheManager using Spring and then pass it into Hibernate. Unfortunately, the EhCacheRegionFactory cannot be passed as an instance object to Hibernate, but instead as a class name to be created by Hibernate itself. Thus, there is no easy way to connect it the Spring application context. As a kludge to get around that, we have a staticsetStaticCacheManagerInstance(CacheManager)that can be called from the Spring application context config to supply theCacheManagerinstance. It's a hack, but I don't see any way around it.- Author:
- bdferris
- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor Description EhCacheRegionFactory()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description protected voidreleaseFromUse()protected net.sf.ehcache.CacheManagerresolveCacheManager(org.hibernate.boot.spi.SessionFactoryOptions settings, Map properties)voidsetCacheManager(net.sf.ehcache.CacheManager cacheManager)static voidsetStaticCacheManagerInstance(net.sf.ehcache.CacheManager cacheManager)-
Methods inherited from class org.hibernate.cache.ehcache.internal.EhcacheRegionFactory
buildDomainDataRegion, cacheExists, createCache, createDomainDataStorageAccess, createQueryResultsRegionStorageAccess, createTimestampsRegionStorageAccess, defaultRegionName, getCacheManager, getImplicitCacheKeysFactory, getOrCreateCache, getTimeout, isStarted, loadResource, prepareForUse, useNormalCacheManager
-
Methods inherited from class org.hibernate.cache.spi.support.RegionFactoryTemplate
buildQueryResultsRegion, buildTimestampsRegion
-
-
-
-
Method Detail
-
setStaticCacheManagerInstance
public static void setStaticCacheManagerInstance(net.sf.ehcache.CacheManager cacheManager)
-
releaseFromUse
protected void releaseFromUse()
- Overrides:
releaseFromUsein classorg.hibernate.cache.ehcache.internal.EhcacheRegionFactory
-
setCacheManager
public void setCacheManager(net.sf.ehcache.CacheManager cacheManager)
-
resolveCacheManager
protected net.sf.ehcache.CacheManager resolveCacheManager(org.hibernate.boot.spi.SessionFactoryOptions settings, Map properties)- Overrides:
resolveCacheManagerin classorg.hibernate.cache.ehcache.internal.EhcacheRegionFactory
-
-