Search in sources :

Example 21 with MergePolicyConfig

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

the class MemberDomConfigProcessor method handleRingBufferNode.

void handleRingBufferNode(Node node, RingbufferConfig rbConfig) {
    for (Node n : childElements(node)) {
        String nodeName = cleanNodeName(n);
        if (matches("capacity", nodeName)) {
            int capacity = getIntegerValue("capacity", getTextContent(n));
            rbConfig.setCapacity(capacity);
        } else if (matches("backup-count", nodeName)) {
            int backupCount = getIntegerValue("backup-count", getTextContent(n));
            rbConfig.setBackupCount(backupCount);
        } else if (matches("async-backup-count", nodeName)) {
            int asyncBackupCount = getIntegerValue("async-backup-count", getTextContent(n));
            rbConfig.setAsyncBackupCount(asyncBackupCount);
        } else if (matches("time-to-live-seconds", nodeName)) {
            int timeToLiveSeconds = getIntegerValue("time-to-live-seconds", getTextContent(n));
            rbConfig.setTimeToLiveSeconds(timeToLiveSeconds);
        } else if (matches("in-memory-format", nodeName)) {
            InMemoryFormat inMemoryFormat = InMemoryFormat.valueOf(upperCaseInternal(getTextContent(n)));
            rbConfig.setInMemoryFormat(inMemoryFormat);
        } else if (matches("ringbuffer-store", nodeName)) {
            RingbufferStoreConfig ringbufferStoreConfig = createRingbufferStoreConfig(n);
            rbConfig.setRingbufferStoreConfig(ringbufferStoreConfig);
        } else if (matches("split-brain-protection-ref", nodeName)) {
            rbConfig.setSplitBrainProtectionName(getTextContent(n));
        } else if (matches("merge-policy", nodeName)) {
            MergePolicyConfig mpConfig = createMergePolicyConfig(n, rbConfig.getMergePolicyConfig());
            rbConfig.setMergePolicyConfig(mpConfig);
        }
    }
    config.addRingBufferConfig(rbConfig);
}
Also used : MergePolicyConfig(com.hazelcast.config.MergePolicyConfig) Node(org.w3c.dom.Node) RingbufferStoreConfig(com.hazelcast.config.RingbufferStoreConfig) InMemoryFormat(com.hazelcast.config.InMemoryFormat)

Example 22 with MergePolicyConfig

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

the class MemberDomConfigProcessor method handleSetNode.

void handleSetNode(Node node, final SetConfig sConfig) {
    for (Node n : childElements(node)) {
        String nodeName = cleanNodeName(n);
        if (matches("max-size", nodeName)) {
            sConfig.setMaxSize(getIntegerValue("max-size", getTextContent(n)));
        } else if (matches("backup-count", nodeName)) {
            sConfig.setBackupCount(getIntegerValue("backup-count", getTextContent(n)));
        } else if (matches("async-backup-count", nodeName)) {
            sConfig.setAsyncBackupCount(getIntegerValue("async-backup-count", getTextContent(n)));
        } else if (matches("item-listeners", nodeName)) {
            handleItemListeners(n, sConfig::addItemListenerConfig);
        } else if (matches("statistics-enabled", nodeName)) {
            sConfig.setStatisticsEnabled(getBooleanValue(getTextContent(n)));
        } else if (matches("split-brain-protection-ref", nodeName)) {
            sConfig.setSplitBrainProtectionName(getTextContent(n));
        } else if (matches("merge-policy", nodeName)) {
            MergePolicyConfig mpConfig = createMergePolicyConfig(n, sConfig.getMergePolicyConfig());
            sConfig.setMergePolicyConfig(mpConfig);
        }
    }
    config.addSetConfig(sConfig);
}
Also used : MergePolicyConfig(com.hazelcast.config.MergePolicyConfig) Node(org.w3c.dom.Node)

Example 23 with MergePolicyConfig

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

the class MapSplitBrainTest method config.

@Override
protected Config config() {
    MergePolicyConfig mergePolicyConfig = new MergePolicyConfig().setPolicy(mergePolicyClass.getName()).setBatchSize(10);
    Config config = super.config();
    config.getMapConfig(mapNameA).setInMemoryFormat(inMemoryFormat).setMergePolicyConfig(mergePolicyConfig).setBackupCount(1).setAsyncBackupCount(0).setStatisticsEnabled(true).setPerEntryStatsEnabled(true);
    config.getMapConfig(mapNameB).setInMemoryFormat(inMemoryFormat).setMergePolicyConfig(mergePolicyConfig).setBackupCount(1).setAsyncBackupCount(0).setStatisticsEnabled(true).setPerEntryStatsEnabled(true);
    return config;
}
Also used : MergePolicyConfig(com.hazelcast.config.MergePolicyConfig) Config(com.hazelcast.config.Config) MergePolicyConfig(com.hazelcast.config.MergePolicyConfig)

Example 24 with MergePolicyConfig

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

the class MultiMapSplitBrainTest method config.

@Override
protected Config config() {
    MergePolicyConfig mergePolicyConfig = new MergePolicyConfig().setPolicy(mergePolicyClass.getName()).setBatchSize(10);
    Config config = super.config();
    config.getMultiMapConfig(multiMapNameA).setBinary(isBinary).setMergePolicyConfig(mergePolicyConfig).setStatisticsEnabled(true).setBackupCount(1).setAsyncBackupCount(0);
    config.getMultiMapConfig(multiMapNameB).setBinary(isBinary).setMergePolicyConfig(mergePolicyConfig).setStatisticsEnabled(true).setBackupCount(1).setAsyncBackupCount(0);
    return config;
}
Also used : MergePolicyConfig(com.hazelcast.config.MergePolicyConfig) MultiMapConfig(com.hazelcast.config.MultiMapConfig) Config(com.hazelcast.config.Config) MergePolicyConfig(com.hazelcast.config.MergePolicyConfig)

Example 25 with MergePolicyConfig

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

the class MergePolicyValidatorCachingProviderIntegrationTest method testCache_withLegacyPutIfAbsentMergePolicy.

@Test
public void testCache_withLegacyPutIfAbsentMergePolicy() {
    MergePolicyConfig legacyMergePolicyConfig = new MergePolicyConfig().setPolicy(PutIfAbsentMergePolicy.class.getName());
    getCache("legacyPutIfAbsent", legacyMergePolicyConfig);
}
Also used : MergePolicyConfig(com.hazelcast.config.MergePolicyConfig) PutIfAbsentMergePolicy(com.hazelcast.spi.merge.PutIfAbsentMergePolicy) QuickTest(com.hazelcast.test.annotation.QuickTest) Test(org.junit.Test)

Aggregations

MergePolicyConfig (com.hazelcast.config.MergePolicyConfig)65 Config (com.hazelcast.config.Config)21 Test (org.junit.Test)20 ReplicatedMapConfig (com.hazelcast.config.ReplicatedMapConfig)18 MapConfig (com.hazelcast.config.MapConfig)17 MultiMapConfig (com.hazelcast.config.MultiMapConfig)17 EntryListenerConfig (com.hazelcast.config.EntryListenerConfig)16 ItemListenerConfig (com.hazelcast.config.ItemListenerConfig)16 QueueStoreConfig (com.hazelcast.config.QueueStoreConfig)15 RingbufferStoreConfig (com.hazelcast.config.RingbufferStoreConfig)15 ScheduledExecutorConfig (com.hazelcast.config.ScheduledExecutorConfig)15 CardinalityEstimatorConfig (com.hazelcast.config.CardinalityEstimatorConfig)13 EvictionConfig (com.hazelcast.config.EvictionConfig)13 ListenerConfig (com.hazelcast.config.ListenerConfig)13 QueueConfig (com.hazelcast.config.QueueConfig)13 RingbufferConfig (com.hazelcast.config.RingbufferConfig)13 EventJournalConfig (com.hazelcast.config.EventJournalConfig)12 ListConfig (com.hazelcast.config.ListConfig)12 MapPartitionLostListenerConfig (com.hazelcast.config.MapPartitionLostListenerConfig)12 SetConfig (com.hazelcast.config.SetConfig)12