@SuppressWarnings("deprecation") @Override public void accept(ConfigurationBuilder builder) { ClusteringConfigurationBuilder clustering = builder.clustering(); CacheMode mode = clustering.cacheMode(); clustering.cacheMode(mode.needsStateTransfer() ? CacheMode.REPL_SYNC : CacheMode.LOCAL); // don't use DefaultConsistentHashFactory for REPL caches (WFLY-9276) clustering.hash().consistentHashFactory(null); clustering.l1().disable(); // Workaround for ISPN-8722 AttributeSet attributes = TemplateConfigurationServiceConfigurator.getAttributes(clustering); attributes.attribute(ClusteringConfiguration.BIAS_ACQUISITION).reset(); attributes.attribute(ClusteringConfiguration.BIAS_LIFESPAN).reset(); attributes.attribute(ClusteringConfiguration.INVALIDATION_BATCH_SIZE).reset(); // Ensure we use the default data container builder.dataContainer().dataContainer(null); // Disable expiration builder.expiration().lifespan(-1).maxIdle(-1); // Disable eviction builder.memory().size(-1).evictionStrategy(EvictionStrategy.MANUAL); builder.persistence().clearStores(); StateTransferConfigurationBuilder stateTransfer = clustering.stateTransfer().fetchInMemoryState(mode.needsStateTransfer()); attributes = TemplateConfigurationServiceConfigurator.getAttributes(stateTransfer); attributes.attribute(StateTransferConfiguration.AWAIT_INITIAL_TRANSFER).reset(); attributes.attribute(StateTransferConfiguration.TIMEOUT).reset(); } }
@SuppressWarnings("deprecation") @Override public void accept(ConfigurationBuilder builder) { ClusteringConfigurationBuilder clustering = builder.clustering(); CacheMode mode = clustering.cacheMode(); clustering.cacheMode(mode.needsStateTransfer() ? CacheMode.REPL_SYNC : CacheMode.LOCAL); // don't use DefaultConsistentHashFactory for REPL caches (WFLY-9276) clustering.hash().consistentHashFactory(null); clustering.l1().disable(); // Workaround for ISPN-8722 AttributeSet attributes = TemplateConfigurationServiceConfigurator.getAttributes(clustering); attributes.attribute(ClusteringConfiguration.BIAS_ACQUISITION).reset(); attributes.attribute(ClusteringConfiguration.BIAS_LIFESPAN).reset(); attributes.attribute(ClusteringConfiguration.INVALIDATION_BATCH_SIZE).reset(); // Ensure we use the default data container builder.dataContainer().dataContainer(null); // Disable expiration builder.expiration().lifespan(-1).maxIdle(-1); // Disable eviction builder.memory().size(-1).evictionStrategy(EvictionStrategy.MANUAL); builder.persistence().clearStores(); StateTransferConfigurationBuilder stateTransfer = clustering.stateTransfer().fetchInMemoryState(mode.needsStateTransfer()); attributes = TemplateConfigurationServiceConfigurator.getAttributes(stateTransfer); attributes.attribute(StateTransferConfiguration.AWAIT_INITIAL_TRANSFER).reset(); attributes.attribute(StateTransferConfiguration.TIMEOUT).reset(); } }
public void testDefaultsWhenEnabledOnly() { Configuration config = new ConfigurationBuilder().clustering().cacheMode(CacheMode.DIST_SYNC).l1().enable().build(); L1Configuration l1Config = config.clustering().l1(); assertTrue(l1Config.enabled()); assertEquals(l1Config.cleanupTaskFrequency(), TimeUnit.MINUTES.toMillis(1)); assertEquals(l1Config.invalidationThreshold(), 0); assertEquals(l1Config.lifespan(), TimeUnit.MINUTES.toMillis(10)); }
@Test public void testSegmentedOffHeapAndL1() { dataContainerFactory = spy(new DataContainerFactory()); doReturn(mock(OffHeapConcurrentMap.class)) .when(dataContainerFactory) .createAndStartOffHeapConcurrentMap(anyInt(), anyInt()); dataContainerFactory.globalConfiguration = GlobalConfigurationBuilder.defaultClusteredBuilder().build(); dataContainerFactory.configuration = new ConfigurationBuilder().clustering() .cacheMode(CacheMode.DIST_ASYNC) .l1().enable() .memory().storageType(StorageType.OFF_HEAP).build(); assertEquals(L1SegmentedDataContainer.class, this.dataContainerFactory.construct(COMPONENT_NAME).getClass()); }
@Test public void testSegmentedL1() { dataContainerFactory.configuration = new ConfigurationBuilder().clustering() .cacheMode(CacheMode.DIST_ASYNC) .l1().enable().build(); assertEquals(L1SegmentedDataContainer.class, this.dataContainerFactory.construct(COMPONENT_NAME).getClass()); }
@Override protected void decorate(ConfigurationBuilder builder) { // Enable L1 builder.clustering().l1().enable(); builder.clustering().remoteTimeout(100, TimeUnit.MINUTES); }
@Override protected void decorate(ConfigurationBuilder builder) { // Enable L1 builder.clustering().l1().enable(); builder.clustering().remoteTimeout(100, TimeUnit.MINUTES); } }
@Override protected ConfigurationBuilder createCacheConfig() { ConfigurationBuilder cfg = hotRodCacheConfiguration(getDefaultClusteredCacheConfig(CacheMode.DIST_SYNC, false)); cfg.clustering().l1().disable(); // Disable L1 explicitly return cfg; }
@Override protected ConfigurationBuilder createCacheConfig() { ConfigurationBuilder cfg = hotRodCacheConfiguration( getDefaultClusteredCacheConfig(CacheMode.DIST_SYNC, false)); cfg.clustering().l1().disable(); // Disable L1 explicitly return cfg; }
@Override protected void createCacheManagers() { ConfigurationBuilder c = getDefaultClusteredCacheConfig(CacheMode.DIST_SYNC, transactional); c.clustering().hash().numSegments(10).numOwners(1); c.clustering().l1().disable(); if (totalOrder != null && totalOrder.booleanValue()) { c.transaction().transactionProtocol(TransactionProtocol.TOTAL_ORDER); } amendConfiguration.accept(c); createClusteredCaches(2, c); }
@Override protected void configureCache(ConfigurationBuilder builder) { super.configureCache(builder); if (builder.clustering().cacheMode().isDistributed()) { builder.clustering().l1().enable(); } }
@Override protected void createCacheManagers() throws Throwable { ConfigurationBuilder dcc = getDefaultClusteredCacheConfig(cacheMode, false); if (biasAcquisition != null) { dcc.clustering().biasAcquisition(biasAcquisition); } dcc.clustering().l1().disable(); createClusteredCaches(nodes, dcc); }
@Override protected void createCacheManagers() throws Throwable { ConfigurationBuilder dcc = getDefaultClusteredCacheConfig(CacheMode.DIST_SYNC, true); dcc.clustering().l1().disable().hash().numOwners(1); createCluster(dcc, 2); waitForClusterToForm(); }
@Override protected void createCacheManagers() throws Throwable { ConfigurationBuilder defaultConfig = getDefaultClusteredCacheConfig(cacheMode); log.debug("defaultConfig = " + defaultConfig.build().clustering().hash().numOwners()); defaultConfig.clustering().l1().disable().stateTransfer().fetchInMemoryState(true); createClusteredCaches(5, defaultConfig); ConsistentHash hash = cache(0).getAdvancedCache().getDistributionManager().getWriteConsistentHash(); List<Address> members = hash.getMembers(); addresses = members.toArray(new Address[members.size()]); }
protected ConfigurationBuilder createConfig() { ConfigurationBuilder cfg = getDefaultClusteredCacheConfig(CacheMode.DIST_SYNC, true); cfg .transaction().lockingMode(LockingMode.PESSIMISTIC) .clustering().l1().disable().hash().numOwners(1) .locking().lockAcquisitionTimeout(TestingUtil.shortTimeoutMillis()); return cfg; }
@Override protected void createCacheManagers() throws Throwable { MyBaseControlledConsistentHashFactory chf = new MyBaseControlledConsistentHashFactory(); builder = getDefaultClusteredCacheConfig(CacheMode.DIST_SYNC, false); builder.clustering().hash().numSegments(1).numOwners(1).consistentHashFactory(chf); builder.clustering().l1().enable().lifespan(10, TimeUnit.MINUTES); createClusteredCaches(3, builder); }
@Override public void call() { ConfigurationBuilder cb = new ConfigurationBuilder(); cb.clustering().cacheMode(CacheMode.DIST_SYNC).l1().disable(); cm.defineConfiguration("testConfigCache", cb.build()); Cache<Object, Object> cache = cm.getCache("testConfigCache"); assert !cache.getCacheConfiguration().clustering().l1().enabled(); } });
@Override protected void createCacheManagers() throws Throwable { builder = TestCacheManagerFactory.getDefaultCacheConfiguration(true); builder.clustering().cacheMode(CacheMode.DIST_SYNC).l1().disable() .locking().isolationLevel(IsolationLevel.REPEATABLE_READ) .transaction().lockingMode(LockingMode.OPTIMISTIC); amendConfig(builder); createCluster(builder, 4); waitForClusterToForm(); }
private ConfigurationBuilder getClusteredCfg(CacheMode mode, boolean l1) { ConfigurationBuilder cfg = getBaseCfg(); cfg .locking().lockAcquisitionTimeout(60000) .clustering().cacheMode(mode).remoteTimeout(60000).stateTransfer().fetchInMemoryState(false); if (mode.isDistributed()) { cfg.clustering().l1().enabled(l1).lifespan(120000); } return cfg; }
@Override protected void createCacheManagers() throws Throwable { ConfigurationBuilder configuration = getDefaultClusteredCacheConfig(CacheMode.DIST_SYNC, true); configuration.transaction().transactionManagerLookup(new EmbeddedTransactionManagerLookup()) .useSynchronization(false) .recovery().enable() .locking().useLockStriping(false) .clustering().hash().numOwners(2) .clustering().l1().disable().stateTransfer().fetchInMemoryState(false); createCluster(configuration, 2); waitForClusterToForm(); advancedCache(1).getAsyncInterceptorChain().addInterceptorBefore(new ForceFailureInterceptor(), InvocationContextInterceptor.class); }