org.onebusaway.container.spring.ehcache
Class EhCacheRegionFactory
java.lang.Object
net.sf.ehcache.hibernate.EhCacheRegionFactory
org.onebusaway.container.spring.ehcache.EhCacheRegionFactory
- All Implemented Interfaces:
- org.hibernate.cache.RegionFactory
public class EhCacheRegionFactory
- extends net.sf.ehcache.hibernate.EhCacheRegionFactory
A Hibernate EhCacheRegionFactory implementation that supports directly
setting the CacheManager
from 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 static
setStaticCacheManagerInstance(CacheManager)
that can be called from
the Spring application context config to supply the CacheManager
instance. It's a hack, but I don't see any way around it.
- Author:
- bdferris
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
NET_SF_EHCACHE_CONFIGURATION_RESOURCE_NAME
public static final String NET_SF_EHCACHE_CONFIGURATION_RESOURCE_NAME
- See Also:
- Constant Field Values
mbeanRegistrationHelper
protected final net.sf.ehcache.hibernate.management.impl.ProviderMBeanRegistrationHelper mbeanRegistrationHelper
manager
protected volatile net.sf.ehcache.CacheManager manager
settings
protected org.hibernate.cfg.Settings settings
EhCacheRegionFactory
public EhCacheRegionFactory(Properties prop)
setStaticCacheManagerInstance
public static void setStaticCacheManagerInstance(net.sf.ehcache.CacheManager cacheManager)
start
public void start(org.hibernate.cfg.Settings settings,
Properties properties)
throws org.hibernate.cache.CacheException
- Specified by:
start
in interface org.hibernate.cache.RegionFactory
- Overrides:
start
in class net.sf.ehcache.hibernate.EhCacheRegionFactory
- Throws:
org.hibernate.cache.CacheException
stop
public void stop()
- Specified by:
stop
in interface org.hibernate.cache.RegionFactory
- Overrides:
stop
in class net.sf.ehcache.hibernate.EhCacheRegionFactory
loadResource
protected static URL loadResource(String arg0)
Copyright © 2012 OneBusAway. All Rights Reserved.