/** * {@inheritDoc} */ public void stop() { releaseCaches(); if (selfCreatedFactory) { ((CacheManagerImpl) jbcFactory).stop(); } }
public void releaseCache(String configName) { synchronized (caches) { if (!caches.containsKey(configName)) throw new IllegalStateException(configName + " not registered"); if (decrementCheckout(configName) == 0) { Cache<Object, Object> cache = caches.remove(configName); destroyCache(cache); } } }
public Set<String> getConfigurationNames() { synchronized (caches) { Set<String> configNames = configRegistry == null ? new HashSet<String>() : configRegistry.getConfigurationNames(); configNames.addAll(getCacheNames()); return configNames; } }
jbcFactory = new CacheManagerImpl(factoryRes, channelFactory); ((CacheManagerImpl) jbcFactory).start(); selfCreatedFactory = true;
public Cache<Object, Object> getCache(String configName, boolean create) throws Exception { Cache<Object, Object> cache; synchronized (caches) { cache = caches.get(configName); if (cache == null && create) { Configuration config = configRegistry.getConfiguration(configName); if (channelFactory != null && config.getMultiplexerStack() != null) { config.getRuntimeConfig().setMuxChannelFactory(channelFactory); } cache = createCache(config); registerCache(cache, configName); } else if (cache != null) { incrementCheckout(configName); } } return cache; }
public void registerCache(Cache<Object, Object> cache, String configName) { synchronized (caches) { if (caches.containsKey(configName)) throw new IllegalStateException(configName + " already registered"); caches.put(configName, cache); incrementCheckout(configName); } }
public void stop() { if (started) { synchronized (caches) { for (Iterator<Map.Entry<String, Cache<Object, Object>>> it = caches.entrySet().iterator(); it.hasNext();) { Map.Entry<String, Cache<Object, Object>> entry = it.next(); destroyCache(entry.getValue()); it.remove(); } caches.clear(); checkouts.clear(); } if (!configRegistryInjected) { ((XmlParsingConfigurationRegistry) configRegistry).stop(); } started = false; } }
factoryRes = PropertiesHelper.getString(LEGACY_CACHE_FACTORY_RESOURCE_PROP, properties, DEF_CACHE_FACTORY_RESOURCE); jbcFactory = new CacheManagerImpl(factoryRes, channelFactory); ((CacheManagerImpl) jbcFactory).start(); selfCreatedFactory = true;
/** * {@inheritDoc} */ public void stop() { releaseCaches(); if (selfCreatedFactory) { ((CacheManagerImpl) jbcFactory).stop(); } }