Search in sources :

Example 61 with MergePolicyConfig

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

the class RingbufferSplitBrainTest method config.

@Override
protected Config config() {
    MergePolicyConfig mergePolicyConfig = new MergePolicyConfig().setPolicy(mergePolicyClass.getName()).setBatchSize(10);
    Config config = super.config();
    config.getRingbufferConfig(ringbufferNameA).setInMemoryFormat(inMemoryFormat).setMergePolicyConfig(mergePolicyConfig).setRingbufferStoreConfig(new RingbufferStoreConfig().setStoreImplementation(ringbufferStoreA)).setBackupCount(1).setAsyncBackupCount(0).setTimeToLiveSeconds(0);
    config.getRingbufferConfig(ringbufferNameB).setInMemoryFormat(inMemoryFormat).setMergePolicyConfig(mergePolicyConfig).setRingbufferStoreConfig(new RingbufferStoreConfig().setStoreImplementation(ringbufferStoreB)).setBackupCount(1).setAsyncBackupCount(0).setTimeToLiveSeconds(0);
    return config;
}
Also used : MergePolicyConfig(com.hazelcast.config.MergePolicyConfig) RingbufferStoreConfig(com.hazelcast.config.RingbufferStoreConfig) Config(com.hazelcast.config.Config) MergePolicyConfig(com.hazelcast.config.MergePolicyConfig) RingbufferStoreConfig(com.hazelcast.config.RingbufferStoreConfig)

Example 62 with MergePolicyConfig

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

the class ReplicatedMapSplitBrainTest method config.

@Override
protected Config config() {
    MergePolicyConfig mergePolicyConfig = new MergePolicyConfig().setPolicy(mergePolicyClass.getName()).setBatchSize(10);
    Config config = super.config();
    config.getReplicatedMapConfig(replicatedMapNameA).setInMemoryFormat(inMemoryFormat).setMergePolicyConfig(mergePolicyConfig).setStatisticsEnabled(false);
    config.getReplicatedMapConfig(replicatedMapNameB).setInMemoryFormat(inMemoryFormat).setMergePolicyConfig(mergePolicyConfig).setStatisticsEnabled(false);
    return config;
}
Also used : MergePolicyConfig(com.hazelcast.config.MergePolicyConfig) Config(com.hazelcast.config.Config) MergePolicyConfig(com.hazelcast.config.MergePolicyConfig)

Example 63 with MergePolicyConfig

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

the class TestContainerMerger method runInternal.

@Override
protected void runInternal() {
    MergePolicyConfig mergePolicyConfig = new MergePolicyConfig();
    SplitBrainMergePolicy mergePolicy = getMergePolicy(mergePolicyConfig);
    assertNotNull("Expected to retrieve a merge policy, but was null", mergePolicy);
    if (mergeOperation != null) {
        invoke(MapService.SERVICE_NAME, mergeOperation, 1);
    }
}
Also used : MergePolicyConfig(com.hazelcast.config.MergePolicyConfig) SplitBrainMergePolicy(com.hazelcast.spi.merge.SplitBrainMergePolicy)

Example 64 with MergePolicyConfig

use of com.hazelcast.config.MergePolicyConfig in project spring-boot-admin by codecentric.

the class SpringBootAdminHazelcastApplication method hazelcastConfig.

// tag::application-hazelcast[]
@Bean
public Config hazelcastConfig() {
    // This map is used to store the events.
    // It should be configured to reliably hold all the data,
    // Spring Boot Admin will compact the events, if there are too many
    MapConfig eventStoreMap = new MapConfig(DEFAULT_NAME_EVENT_STORE_MAP).setInMemoryFormat(InMemoryFormat.OBJECT).setBackupCount(1).setMergePolicyConfig(new MergePolicyConfig(PutIfAbsentMergePolicy.class.getName(), 100));
    // This map is used to deduplicate the notifications.
    // If data in this map gets lost it should not be a big issue as it will atmost
    // lead to
    // the same notification to be sent by multiple instances
    MapConfig sentNotificationsMap = new MapConfig(DEFAULT_NAME_SENT_NOTIFICATIONS_MAP).setInMemoryFormat(InMemoryFormat.OBJECT).setBackupCount(1).setEvictionConfig(new EvictionConfig().setEvictionPolicy(EvictionPolicy.LRU).setMaxSizePolicy(MaxSizePolicy.PER_NODE)).setMergePolicyConfig(new MergePolicyConfig(PutIfAbsentMergePolicy.class.getName(), 100));
    Config config = new Config();
    config.addMapConfig(eventStoreMap);
    config.addMapConfig(sentNotificationsMap);
    config.setProperty("hazelcast.jmx", "true");
    // WARNING: This setups a local cluster, you change it to fit your needs.
    config.getNetworkConfig().getJoin().getMulticastConfig().setEnabled(false);
    TcpIpConfig tcpIpConfig = config.getNetworkConfig().getJoin().getTcpIpConfig();
    tcpIpConfig.setEnabled(true);
    tcpIpConfig.setMembers(singletonList("127.0.0.1"));
    return config;
}
Also used : MergePolicyConfig(com.hazelcast.config.MergePolicyConfig) EvictionConfig(com.hazelcast.config.EvictionConfig) MapConfig(com.hazelcast.config.MapConfig) EvictionConfig(com.hazelcast.config.EvictionConfig) Config(com.hazelcast.config.Config) TcpIpConfig(com.hazelcast.config.TcpIpConfig) MergePolicyConfig(com.hazelcast.config.MergePolicyConfig) MapConfig(com.hazelcast.config.MapConfig) TcpIpConfig(com.hazelcast.config.TcpIpConfig) Bean(org.springframework.context.annotation.Bean)

Example 65 with MergePolicyConfig

use of com.hazelcast.config.MergePolicyConfig in project spring-boot-admin by codecentric.

the class HazelcastEventStoreWithServerConfigTest method createHazelcastConfig.

// config from sample project
private Config createHazelcastConfig() {
    // This map is used to store the events.
    // It should be configured to reliably hold all the data,
    // Spring Boot Admin will compact the events, if there are too many
    MapConfig eventStoreMap = new MapConfig(DEFAULT_NAME_EVENT_STORE_MAP).setInMemoryFormat(InMemoryFormat.OBJECT).setBackupCount(1).setMergePolicyConfig(new MergePolicyConfig(PutIfAbsentMergePolicy.class.getName(), 100));
    // This map is used to deduplicate the notifications.
    // If data in this map gets lost it should not be a big issue as it will atmost
    // lead to
    // the same notification to be sent by multiple instances
    MapConfig sentNotificationsMap = new MapConfig(DEFAULT_NAME_SENT_NOTIFICATIONS_MAP).setInMemoryFormat(InMemoryFormat.OBJECT).setBackupCount(1).setEvictionConfig(new EvictionConfig().setEvictionPolicy(EvictionPolicy.LRU)).setMergePolicyConfig(new MergePolicyConfig(PutIfAbsentMergePolicy.class.getName(), 100));
    Config config = new Config();
    config.addMapConfig(eventStoreMap);
    config.addMapConfig(sentNotificationsMap);
    config.setProperty("hazelcast.jmx", "true");
    // WARNING: This setups a local cluster, you change it to fit your needs.
    config.getNetworkConfig().getJoin().getMulticastConfig().setEnabled(false);
    TcpIpConfig tcpIpConfig = config.getNetworkConfig().getJoin().getTcpIpConfig();
    tcpIpConfig.setEnabled(true);
    tcpIpConfig.setMembers(singletonList("127.0.0.1"));
    return config;
}
Also used : MergePolicyConfig(com.hazelcast.config.MergePolicyConfig) EvictionConfig(com.hazelcast.config.EvictionConfig) Config(com.hazelcast.config.Config) MapConfig(com.hazelcast.config.MapConfig) TcpIpConfig(com.hazelcast.config.TcpIpConfig) EvictionConfig(com.hazelcast.config.EvictionConfig) MergePolicyConfig(com.hazelcast.config.MergePolicyConfig) MapConfig(com.hazelcast.config.MapConfig) TcpIpConfig(com.hazelcast.config.TcpIpConfig)

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