Search in sources :

Example 21 with CacheSimpleConfig

use of com.hazelcast.config.CacheSimpleConfig in project hazelcast by hazelcast.

the class CacheEventJournalBounceTest method getConfig.

@Override
protected Config getConfig() {
    final CacheSimpleConfig cacheConfig = new CacheSimpleConfig().setName(TEST_CACHE_NAME);
    cacheConfig.getEvictionConfig().setSize(Integer.MAX_VALUE);
    Config config = super.getConfig().addCacheConfig(cacheConfig);
    config.getCacheConfig(TEST_CACHE_NAME).setEventJournalConfig(new EventJournalConfig().setEnabled(true).setCapacity(10000));
    return config;
}
Also used : CacheSimpleConfig(com.hazelcast.config.CacheSimpleConfig) Config(com.hazelcast.config.Config) EventJournalConfig(com.hazelcast.config.EventJournalConfig) CacheSimpleConfig(com.hazelcast.config.CacheSimpleConfig) EventJournalConfig(com.hazelcast.config.EventJournalConfig)

Example 22 with CacheSimpleConfig

use of com.hazelcast.config.CacheSimpleConfig in project hazelcast by hazelcast.

the class CacheEventJournalBasicTest method getConfig.

@Override
protected Config getConfig() {
    Config config = super.getConfig();
    CacheSimpleConfig nonEvictingCache = config.getCacheConfig(NON_EVICTING_CACHE).setInMemoryFormat(getInMemoryFormat());
    MaxSizePolicy maxSizePolicy = getInMemoryFormat() == InMemoryFormat.NATIVE ? USED_NATIVE_MEMORY_SIZE : DEFAULT_MAX_SIZE_POLICY;
    nonEvictingCache.getEvictionConfig().setMaxSizePolicy(maxSizePolicy).setSize(Integer.MAX_VALUE);
    final CacheSimpleConfig evictingCache = config.getCacheConfig(EVICTING_CACHE).setInMemoryFormat(getInMemoryFormat());
    evictingCache.getEvictionConfig().setMaxSizePolicy(maxSizePolicy);
    return config;
}
Also used : CacheSimpleConfig(com.hazelcast.config.CacheSimpleConfig) MaxSizePolicy(com.hazelcast.config.MaxSizePolicy) Config(com.hazelcast.config.Config) CacheSimpleConfig(com.hazelcast.config.CacheSimpleConfig)

Example 23 with CacheSimpleConfig

use of com.hazelcast.config.CacheSimpleConfig in project hazelcast by hazelcast.

the class AddCacheConfigMessageTask method getConfig.

@Override
protected IdentifiedDataSerializable getConfig() {
    CacheSimpleConfig config = new CacheSimpleConfig();
    config.setAsyncBackupCount(parameters.asyncBackupCount);
    config.setBackupCount(parameters.backupCount);
    config.setCacheEntryListeners(parameters.cacheEntryListeners);
    config.setCacheLoader(parameters.cacheLoader);
    config.setCacheLoaderFactory(parameters.cacheLoaderFactory);
    config.setCacheWriter(parameters.cacheWriter);
    config.setCacheWriterFactory(parameters.cacheWriterFactory);
    config.setDisablePerEntryInvalidationEvents(parameters.disablePerEntryInvalidationEvents);
    config.setEvictionConfig(parameters.evictionConfig.asEvictionConfig(serializationService));
    if (parameters.expiryPolicyFactoryClassName != null) {
        config.setExpiryPolicyFactory(parameters.expiryPolicyFactoryClassName);
    } else if (parameters.timedExpiryPolicyFactoryConfig != null) {
        ExpiryPolicyFactoryConfig expiryPolicyFactoryConfig = new ExpiryPolicyFactoryConfig(parameters.timedExpiryPolicyFactoryConfig);
        config.setExpiryPolicyFactoryConfig(expiryPolicyFactoryConfig);
    }
    config.setEventJournalConfig(parameters.eventJournalConfig);
    config.setHotRestartConfig(parameters.hotRestartConfig);
    config.setInMemoryFormat(InMemoryFormat.valueOf(parameters.inMemoryFormat));
    config.setKeyType(parameters.keyType);
    config.setManagementEnabled(parameters.managementEnabled);
    config.setMergePolicyConfig(mergePolicyConfig(parameters.mergePolicy, parameters.mergeBatchSize));
    config.setName(parameters.name);
    if (parameters.partitionLostListenerConfigs != null && !parameters.partitionLostListenerConfigs.isEmpty()) {
        List<CachePartitionLostListenerConfig> listenerConfigs = (List<CachePartitionLostListenerConfig>) adaptListenerConfigs(parameters.partitionLostListenerConfigs);
        config.setPartitionLostListenerConfigs(listenerConfigs);
    } else {
        config.setPartitionLostListenerConfigs(new ArrayList<>());
    }
    config.setSplitBrainProtectionName(parameters.splitBrainProtectionName);
    config.setReadThrough(parameters.readThrough);
    config.setStatisticsEnabled(parameters.statisticsEnabled);
    config.setValueType(parameters.valueType);
    config.setWanReplicationRef(parameters.wanReplicationRef);
    config.setWriteThrough(parameters.writeThrough);
    if (parameters.isMerkleTreeConfigExists) {
        config.setMerkleTreeConfig(parameters.merkleTreeConfig);
    }
    return config;
}
Also used : ExpiryPolicyFactoryConfig(com.hazelcast.config.CacheSimpleConfig.ExpiryPolicyFactoryConfig) CacheSimpleConfig(com.hazelcast.config.CacheSimpleConfig) CachePartitionLostListenerConfig(com.hazelcast.config.CachePartitionLostListenerConfig) List(java.util.List) ArrayList(java.util.ArrayList)

Example 24 with CacheSimpleConfig

use of com.hazelcast.config.CacheSimpleConfig in project hazelcast by hazelcast.

the class AddCacheConfigMessageTask method checkStaticConfigDoesNotExist.

@Override
protected boolean checkStaticConfigDoesNotExist(IdentifiedDataSerializable config) {
    DynamicConfigurationAwareConfig nodeConfig = (DynamicConfigurationAwareConfig) nodeEngine.getConfig();
    CacheSimpleConfig cacheConfig = (CacheSimpleConfig) config;
    return nodeConfig.checkStaticConfigDoesNotExist(nodeConfig.getStaticConfig().getCacheConfigs(), cacheConfig.getName(), cacheConfig);
}
Also used : CacheSimpleConfig(com.hazelcast.config.CacheSimpleConfig) DynamicConfigurationAwareConfig(com.hazelcast.internal.dynamicconfig.DynamicConfigurationAwareConfig)

Example 25 with CacheSimpleConfig

use of com.hazelcast.config.CacheSimpleConfig in project hazelcast by hazelcast.

the class MemberDomConfigProcessor method handleCache.

protected void handleCache(Node node) throws Exception {
    CacheSimpleConfig cacheConfig = ConfigUtils.getByNameOrNew(config.getCacheConfigs(), getAttribute(node, "name"), CacheSimpleConfig.class);
    handleCacheNode(node, cacheConfig);
}
Also used : CacheSimpleConfig(com.hazelcast.config.CacheSimpleConfig)

Aggregations

CacheSimpleConfig (com.hazelcast.config.CacheSimpleConfig)84 Test (org.junit.Test)41 Config (com.hazelcast.config.Config)40 QuickTest (com.hazelcast.test.annotation.QuickTest)37 EvictionConfig (com.hazelcast.config.EvictionConfig)17 ParallelJVMTest (com.hazelcast.test.annotation.ParallelJVMTest)17 BeforeClass (org.junit.BeforeClass)16 CachePartitionLostListenerConfig (com.hazelcast.config.CachePartitionLostListenerConfig)15 MapConfig (com.hazelcast.config.MapConfig)11 ClientConfig (com.hazelcast.client.config.ClientConfig)10 EventJournalConfig (com.hazelcast.config.EventJournalConfig)10 MergePolicyConfig (com.hazelcast.config.MergePolicyConfig)10 HazelcastInstance (com.hazelcast.core.HazelcastInstance)10 ExpiryPolicyFactoryConfig (com.hazelcast.config.CacheSimpleConfig.ExpiryPolicyFactoryConfig)9 QuorumConfig (com.hazelcast.config.QuorumConfig)9 CacheConfig (com.hazelcast.config.CacheConfig)8 TimedExpiryPolicyFactoryConfig (com.hazelcast.config.CacheSimpleConfig.ExpiryPolicyFactoryConfig.TimedExpiryPolicyFactoryConfig)8 QueueConfig (com.hazelcast.config.QueueConfig)8 CacheSimpleEntryListenerConfig (com.hazelcast.config.CacheSimpleEntryListenerConfig)7 CardinalityEstimatorConfig (com.hazelcast.config.CardinalityEstimatorConfig)7