@Override protected Collection<Cache> loadCaches() { net.sf.ehcache.CacheManager cacheManager = getCacheManager(); Assert.state(cacheManager != null, "No CacheManager set"); Status status = cacheManager.getStatus(); if (!Status.STATUS_ALIVE.equals(status)) { throw new IllegalStateException( "An 'alive' EhCache CacheManager is required - current cache is " + status.toString()); } String[] names = getCacheManager().getCacheNames(); Collection<Cache> caches = new LinkedHashSet<>(names.length); for (String name : names) { caches.add(new EhCacheCache(getCacheManager().getEhcache(name))); } return caches; }
@Override protected Collection<Cache> loadCaches() { net.sf.ehcache.CacheManager cacheManager = getCacheManager(); Assert.state(cacheManager != null, "No CacheManager set"); Status status = cacheManager.getStatus(); if (!Status.STATUS_ALIVE.equals(status)) { throw new IllegalStateException( "An 'alive' EhCache CacheManager is required - current cache is " + status.toString()); } String[] names = getCacheManager().getCacheNames(); Collection<Cache> caches = new LinkedHashSet<>(names.length); for (String name : names) { caches.add(new EhCacheCache(getCacheManager().getEhcache(name))); } return caches; }
@Override protected Collection<Cache> loadCaches() { Assert.notNull(this.cacheManager, "A backing EhCache CacheManager is required"); Status status = this.cacheManager.getStatus(); Assert.isTrue(Status.STATUS_ALIVE.equals(status), "An 'alive' EhCache CacheManager is required - current cache is " + status.toString()); String[] names = this.cacheManager.getCacheNames(); Collection<Cache> caches = Sets.newLinkedHashSetWithExpectedSize(names.length); for (String name : names) { if (enableMetrics) { caches.add(new InstrumentedEhCacheCache(this.cacheManager.getEhcache(name))); } else { caches.add(new EhCacheCache(this.cacheManager.getEhcache(name))); } } return caches; }
/** * Gets the status attribute of the Ehcache * * @return The status value, as a String from the Status enum class */ public String getStatus() { return cacheManager.getStatus().toString(); }
/** * {@inheritDoc} */ public String getStatus() { return cacheManager.getStatus().toString(); }
/** * Freezes part of the configuration that need to be, and runs validation checks on the Configuration. * * @param cacheManager the CacheManager instance being configured * @throws InvalidConfigurationException With all the associated errors */ public RuntimeCfg setupFor(final CacheManager cacheManager, final String fallbackName) throws InvalidConfigurationException { if (cfg != null) { if (cfg.cacheManager == cacheManager) { return cfg; } else if (cfg.cacheManager.getStatus() != Status.STATUS_SHUTDOWN) { throw new IllegalStateException("You cannot share a Configuration instance across multiple running CacheManager instances"); } } final Collection<ConfigError> errors = validate(); if (!errors.isEmpty()) { throw new InvalidConfigurationException(errors); } cfg = new Configuration.RuntimeCfg(cacheManager, fallbackName); return cfg; }
@Override public boolean isClosed() { return cacheManager.getStatus() == Status.STATUS_SHUTDOWN; }
@Override public boolean isClosed() { return cacheManager.getStatus() == Status.STATUS_SHUTDOWN; }
public void shutdown() { if (cacheManager != null && cacheManager.getStatus() == Status.STATUS_ALIVE) { cacheManager.shutdown(); } }
/** * Gets the status attribute of the Ehcache * * @return The status value, as a String from the Status enum class */ public String getStatus() { return cacheManager.getStatus().toString(); }
/** * Gets the status attribute of the Ehcache * * @return The status value, as a String from the Status enum class */ public String getStatus() { return cacheManager.getStatus().toString(); }
/** * {@inheritDoc} */ public String getStatus() { return cacheManager.getStatus().toString(); }
public void shutdown() { if (cacheManager != null && cacheManager.getStatus() == Status.STATUS_ALIVE) { cacheManager.shutdown(); } }
/** * {@inheritDoc} */ public String getStatus() { return cacheManager.getStatus().toString(); }
/** * Gets the status attribute of the Ehcache * * @return The status value, as a String from the Status enum class */ public String getStatus() { return cacheManager.getStatus().toString(); }
/** * {@inheritDoc} */ public String getStatus() { return cacheManager.getStatus().toString(); }
/** * Service INIT */ public void init() { if (cacheManager == null) { throw new IllegalStateException("init(): Ehcache CacheManager is null!"); } log.info("INIT: " + cacheManager.getStatus() + ", caches: " + Arrays.asList(cacheManager.getCacheNames())); if (serverConfigurationService.getBoolean("memory.ehcache.jmx", true)) { EhCacheJmxRegistration registration = new EhCacheJmxRegistration(); registration.register(cacheManager); } }
/** * See also http://ehcache.org/documentation/shutdown.html for shutting it down cleanly. */ public void shutdown() { if(ehcacheManager != null && Status.STATUS_ALIVE.equals( ehcacheManager.getStatus() ) ) { // lookup caches and attempt to shut them down if active shutdownIfActive( ehcacheManager.getCache( INTERACTION_CACHE_NAME ) ); shutdownIfActive( ehcacheManager.getCache( INTERACTORS_CACHE_NAME ) ); shutdownIfActive( ehcacheManager.getCache( INTERACTOR_SYNONYMS_CACHE_NAME ) ); log.info( "Shutting down EHCache EHCacheManager..." ); ehcacheManager.shutdown(); } }
@RestMethod public void getCacheManagerStatus(RestResponse response) throws IOException { response.value(cacheManager.getStatus().toString()); }
@Override protected Collection<Cache> loadCaches() { Status status = getCacheManager().getStatus(); if (!Status.STATUS_ALIVE.equals(status)) { throw new IllegalStateException( "An 'alive' EhCache CacheManager is required - current cache is " + status.toString()); } String[] names = getCacheManager().getCacheNames(); Collection<Cache> caches = new LinkedHashSet<Cache>(names.length); for (String name : names) { caches.add(new EhCacheCache(getCacheManager().getEhcache(name))); } return caches; }