@Override public EmbeddedCacheManager get() { GlobalConfiguration config = this.configuration.get(); String defaultCacheName = config.defaultCacheName().orElse(null); // We need to create a dummy default configuration if cache has a default cache Configuration defaultConfiguration = (defaultCacheName != null) ? new ConfigurationBuilder().build() : null; EmbeddedCacheManager manager = new DefaultCacheManager(config, defaultConfiguration, false); // Undefine the default cache, if we defined one if (defaultCacheName != null) { manager.undefineConfiguration(defaultCacheName); } // Override GlobalConfigurationManager with a local implementation @SuppressWarnings("deprecation") BasicComponentRegistry registry = manager.getGlobalComponentRegistry().getComponent(BasicComponentRegistry.class); registry.replaceComponent(GlobalConfigurationManager.class.getName(), new LocalGlobalConfigurationManager(), false); registry.rewire(); manager.start(); manager.addListener(this); InfinispanLogger.ROOT_LOGGER.debugf("%s cache container started", this.name); return manager; }
public static void undefineContainerConfiguration(final EmbeddedCacheManager container, final String name) { PrivilegedAction<Void> action = () -> { container.undefineConfiguration(name); return null; }; doPrivileged(action); }
public void destroy() { pendingPuts.stop(); pendingPuts.getCacheManager().undefineConfiguration( pendingPuts.getName() ); }
protected void stopCacheRegions() { log.debug( "Clear region references" ); getCacheCommandFactory().clearRegions( regions ); // Ensure we cleanup any caches we created regions.forEach( region -> { region.destroy(); manager.undefineConfiguration( region.getCache().getName() ); } ); regions.clear(); }
@AfterMethod(alwaysRun = true) private void cleanAfterMethod() { cacheManager.administration().removeCache(CACHE_NAME); cacheManager.undefineConfiguration(CACHE_NAME); cacheManager.administration().removeCache(INTERNAL_CACHE_NAME); internalCacheRegistry.unregisterInternalCache(INTERNAL_CACHE_NAME); }
@Test(expectedExceptions=IllegalStateException.class) public void testConfigurationUndefineWhileInUse() { cm = TestCacheManagerFactory.createCacheManager(); cm.defineConfiguration("testConfig", new ConfigurationBuilder().build()); cm.getCache("testConfig"); cm.undefineConfiguration("testConfig"); }
@Override public EmbeddedCacheManager get() { GlobalConfiguration config = this.configuration.get(); String defaultCacheName = config.defaultCacheName().orElse(null); // We need to create a dummy default configuration if cache has a default cache Configuration defaultConfiguration = (defaultCacheName != null) ? new ConfigurationBuilder().build() : null; EmbeddedCacheManager manager = new DefaultCacheManager(config, defaultConfiguration, false); // Undefine the default cache, if we defined one if (defaultCacheName != null) { manager.undefineConfiguration(defaultCacheName); } // Override GlobalConfigurationManager with a local implementation @SuppressWarnings("deprecation") BasicComponentRegistry registry = manager.getGlobalComponentRegistry().getComponent(BasicComponentRegistry.class); registry.replaceComponent(GlobalConfigurationManager.class.getName(), new LocalGlobalConfigurationManager(), false); registry.rewire(); manager.start(); manager.addListener(this); InfinispanLogger.ROOT_LOGGER.debugf("%s cache container started", this.name); return manager; }
manager.undefineConfiguration(regionName); manager.undefineConfiguration(regionName);
public void testConfigurationUndefine() { cm = TestCacheManagerFactory.createCacheManager(); cm.defineConfiguration("testConfig", new ConfigurationBuilder().build()); cm.undefineConfiguration("testConfig"); assertNull(cm.getCacheConfiguration("testConfig")); }