@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(); } }
case ENABLED: if (Boolean.parseBoolean(value)) { builder.clustering().l1().enable(); } else { builder.clustering().l1().disable(); builder.clustering().l1().invalidationThreshold(Integer.parseInt(value)); break; case LIFESPAN: builder.clustering().l1().lifespan(Long.parseLong(value)); break; case INVALIDATION_CLEANUP_TASK_FREQUENCY: builder.clustering().l1().cleanupTaskFrequency(Long.parseLong(value)); break; case ON_REHASH:
@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(); }
@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()]); }
@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); }
public static ConfigurationBuilder createTestConfiguration(TransactionMode transactionMode) { ConfigurationBuilder builder = TestCacheManagerFactory.getDefaultCacheConfiguration(true); builder .clustering() .cacheMode(CacheMode.DIST_SYNC) .remoteTimeout(10000) .stateTransfer() .fetchInMemoryState(true) .l1() .enable() .transaction() .transactionMode(transactionMode) .locking() .lockAcquisitionTimeout(10000) .invocationBatching() .disable() .deadlockDetection() .disable() .jmxStatistics() .disable() ; return builder; }
@Override protected void decorate(ConfigurationBuilder builder) { // Enable L1 builder.clustering().l1().enable(); builder.clustering().remoteTimeout(100, TimeUnit.MINUTES); }
@Override protected void createCacheManagers() throws Throwable { ConfigurationBuilder c = new ConfigurationBuilder(); c .locking() .isolationLevel(IsolationLevel.READ_COMMITTED) .lockAcquisitionTimeout(60000) .useLockStriping(false) .clustering() .cacheMode(CacheMode.DIST_SYNC) .remoteTimeout(30000) .l1().disable() .transaction() .lockingMode(LockingMode.PESSIMISTIC) .transactionManagerLookup(new EmbeddedTransactionManagerLookup()); GlobalConfigurationBuilder gc = GlobalConfigurationBuilder.defaultClusteredBuilder(); gc.transport().distributedSyncTimeout(60000); List<EmbeddedCacheManager> cacheManagers = new LinkedList<>(); for (int i = 0; i < NUM_NODES; i++) cacheManagers.add(createClusteredCacheManager(gc, c)); registerCacheManager(cacheManagers.toArray(new EmbeddedCacheManager[NUM_NODES])); }
@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()); }
@Override protected void createCacheManagers() throws Throwable { ConfigurationBuilder builder = TestCacheManagerFactory.getDefaultCacheConfiguration(true); builder.clustering().cacheMode(CacheMode.DIST_SYNC) .l1().disable() .clustering().stateTransfer().fetchInMemoryState(true) .locking().useLockStriping(false) .clustering().hash().numOwners(3).numSegments(60) .stateTransfer().chunkSize(50); createCluster(builder, 4); c0 = cache(0); c1 = cache(1); c2 = cache(2); c3 = cache(3); waitForClusterToForm(); log.debug("Rehash is complete!"); expected = new HashMap<Integer, BigObject>(); }
configuration.clustering().l1().enabled(l1CacheEnabled); if (groupers) { configuration.clustering().hash().groups().enabled(true); configuration.clustering().hash().groups().withGroupers(Collections.singletonList(new KXGrouper())); if (l1CacheEnabled) configuration.clustering().l1().invalidationThreshold(l1Threshold); return configuration;
protected final ConfigurationBuilder createConfigurationBuilder() { ConfigurationBuilder builder = getDefaultClusteredCacheConfig(CacheMode.DIST_SYNC, transactional); builder.clustering() .hash().numOwners(2).consistentHashFactory(new SingleKeyConsistentHashFactory()).numSegments(1) .l1().enabled(l1) .stateTransfer().fetchInMemoryState(true); return builder; }
@Override protected void createCacheManagers() throws Throwable { dccc = getDefaultClusteredCacheConfig(CacheMode.DIST_SYNC, true, true); dccc.transaction().transactionManagerLookup(new EmbeddedTransactionManagerLookup()); dccc.clustering().hash().l1().disable().locking().lockAcquisitionTimeout(TestingUtil.shortTimeoutMillis()); dccc.clustering().stateTransfer().fetchInMemoryState(true); createCluster(dccc, 2); waitForClusterToForm(); }