/** * Build an EhCache {@link CacheManager} from the given configuration resource. * @param configLocation the location of the configuration file (as a Spring resource) * @return the new EhCache CacheManager * @throws CacheException in case of configuration parsing failure */ public static CacheManager buildCacheManager(Resource configLocation) throws CacheException { return new CacheManager(parseConfiguration(configLocation)); }
/** * Build an EhCache {@link CacheManager} from the default configuration. * <p>The CacheManager will be configured from "ehcache.xml" in the root of the class path * (that is, default EhCache initialization - as defined in the EhCache docs - will apply). * If no configuration file can be found, a fail-safe fallback configuration will be used. * @return the new EhCache CacheManager * @throws CacheException in case of configuration parsing failure */ public static CacheManager buildCacheManager() throws CacheException { return new CacheManager(ConfigurationFactory.parseConfiguration()); }
/** * Build an EhCache {@link CacheManager} from the given configuration resource. * @param name the desired name of the cache manager * @param configLocation the location of the configuration file (as a Spring resource) * @return the new EhCache CacheManager * @throws CacheException in case of configuration parsing failure */ public static CacheManager buildCacheManager(String name, Resource configLocation) throws CacheException { Configuration configuration = parseConfiguration(configLocation); configuration.setName(name); return new CacheManager(configuration); }
/** * Build an EhCache {@link CacheManager} from the default configuration. * <p>The CacheManager will be configured from "ehcache.xml" in the root of the class path * (that is, default EhCache initialization - as defined in the EhCache docs - will apply). * If no configuration file can be found, a fail-safe fallback configuration will be used. * @param name the desired name of the cache manager * @return the new EhCache CacheManager * @throws CacheException in case of configuration parsing failure */ public static CacheManager buildCacheManager(String name) throws CacheException { Configuration configuration = ConfigurationFactory.parseConfiguration(); configuration.setName(name); return new CacheManager(configuration); }
/** * Build an EhCache {@link CacheManager} from the given configuration resource. * @param configLocation the location of the configuration file (as a Spring resource) * @return the new EhCache CacheManager * @throws CacheException in case of configuration parsing failure */ public static CacheManager buildCacheManager(Resource configLocation) throws CacheException { return new CacheManager(parseConfiguration(configLocation)); }
/** * Build an EhCache {@link CacheManager} from the default configuration. * <p>The CacheManager will be configured from "ehcache.xml" in the root of the class path * (that is, default EhCache initialization - as defined in the EhCache docs - will apply). * If no configuration file can be found, a fail-safe fallback configuration will be used. * @return the new EhCache CacheManager * @throws CacheException in case of configuration parsing failure */ public static CacheManager buildCacheManager() throws CacheException { return new CacheManager(ConfigurationFactory.parseConfiguration()); }
this.cacheManager = CacheManager.getCacheManager(this.cacheManagerName); if (this.cacheManager == null) { this.cacheManager = new CacheManager(configuration); this.cacheManager = new CacheManager(configuration);
/** * Build an EhCache {@link CacheManager} from the given configuration resource. * @param name the desired name of the cache manager * @param configLocation the location of the configuration file (as a Spring resource) * @return the new EhCache CacheManager * @throws CacheException in case of configuration parsing failure */ public static CacheManager buildCacheManager(String name, Resource configLocation) throws CacheException { Configuration configuration = parseConfiguration(configLocation); configuration.setName(name); return new CacheManager(configuration); }
private net.sf.ehcache.CacheManager ensureCacheManager() { try { if (this.manager == null) { if (log.isDebugEnabled()) { log.debug("cacheManager property not set. Constructing CacheManager instance... "); } //using the CacheManager constructor, the resulting instance is _not_ a VM singleton //(as would be the case by calling CacheManager.getInstance(). We do not use the getInstance here //because we need to know if we need to destroy the CacheManager instance - using the static call, //we don't know which component is responsible for shutting it down. By using a single EhCacheManager, //it will always know to shut down the instance if it was responsible for creating it. this.manager = new net.sf.ehcache.CacheManager(getCacheManagerConfigFileInputStream()); if (log.isTraceEnabled()) { log.trace("instantiated Ehcache CacheManager instance."); } cacheManagerImplicitlyCreated = true; if (log.isDebugEnabled()) { log.debug("implicit cacheManager created successfully."); } } return this.manager; } catch (Exception e) { throw new CacheException(e); } }
/** * Build an EhCache {@link CacheManager} from the default configuration. * <p>The CacheManager will be configured from "ehcache.xml" in the root of the class path * (that is, default EhCache initialization - as defined in the EhCache docs - will apply). * If no configuration file can be found, a fail-safe fallback configuration will be used. * @param name the desired name of the cache manager * @return the new EhCache CacheManager * @throws CacheException in case of configuration parsing failure */ public static CacheManager buildCacheManager(String name) throws CacheException { Configuration configuration = ConfigurationFactory.parseConfiguration(); configuration.setName(name); return new CacheManager(configuration); }
this.cacheManager = CacheManager.getCacheManager(this.cacheManagerName); if (this.cacheManager == null) { this.cacheManager = new CacheManager(configuration); this.cacheManager = new CacheManager(configuration);
final Configuration configuration = ConfigurationFactory.parseConfiguration(); setCacheManagerNameIfNeeded( settings, configuration, properties ); return new CacheManager( configuration ); final Configuration configuration = HibernateEhcacheUtils.loadAndCorrectConfiguration( url ); setCacheManagerNameIfNeeded( settings, configuration, properties ); return new CacheManager( configuration );
@Before public void setup() { cacheManager = new CacheManager(new Configuration().name("EhCacheCacheTests") .defaultCache(new CacheConfiguration("default", 100))); nativeCache = new net.sf.ehcache.Cache(new CacheConfiguration(CACHE_NAME, 100)); cacheManager.addCache(nativeCache); cache = new EhCacheCache(nativeCache); }
@Before public void setup() { nativeCacheManager = new CacheManager(new Configuration().name("EhCacheCacheManagerTests") .defaultCache(new CacheConfiguration("default", 100))); addNativeCache(CACHE_NAME); cacheManager = new EhCacheCacheManager(nativeCacheManager); cacheManager.setTransactionAware(false); cacheManager.afterPropertiesSet(); transactionalCacheManager = new EhCacheCacheManager(nativeCacheManager); transactionalCacheManager.setTransactionAware(true); transactionalCacheManager.afterPropertiesSet(); }
/** * Returns a new cacheManager or returns already created one. * If another cacheManager with same name already exists in the VM, returns it. Otherwise creates a new one and returns the new * cacheManager. * Subsequent calls with config having same name of the cacheManager will return same instance until it has been shut down. * There can be only one unnamed CacheManager in the VM * * @param configuration the configuration object * @param msg Message printed when creating new cacheManager * @return a new cacheManager or an already existing one in the VM with same name * @since 2.5 */ private static CacheManager newInstance(Configuration configuration, String msg) throws CacheException { synchronized (CacheManager.class) { String name = configuration.getName(); if (name == null) { name = DEFAULT_NAME; } CacheManager cacheManager = CACHE_MANAGERS_MAP.get(name); if (cacheManager == null) { LOG.debug(msg); cacheManager = new CacheManager(configuration); } return cacheManager; } }
public void start() { synchronized (CacheManager.class) { if (this.manager == null) { FileLocator fileLocator = new FileLocator(); InputStream pathCongfgName = fileLocator .getConfStream(ehcacheConf.getEhcacheConfFileName()); this.manager = new CacheManager(pathCongfgName); } } }
manager = new CacheManager(); } else { URL url; url = loadResource(configurationResourceName); manager = new CacheManager(overwriteCacheManagerIfConfigured(HibernateUtil.loadAndCorrectConfiguration(url), properties));
manager = new CacheManager(configuration); } else { URL url; manager = new CacheManager(HibernateUtil.overwriteCacheManagerIfConfigured(configuration, properties));
@Override public void start() { if (ehcacheName != null) manager = CacheManager.getCacheManager(ehcacheName); if (manager == null) { manager = new CacheManager(); } }
static public void makeStandardCacheManager(String configFile, String cacheDir) throws IOException { String config = IO.readFile(configFile); String configString = StringUtil2.substitute(config, "${cacheDir}", cacheDir); cacheLog.info("thredds.filesystem.CacheManager configuraton " + configString); cacheManager = new net.sf.ehcache.CacheManager(new StringBufferInputStream(configString)); }