use of com.hazelcast.config.HotRestartConfig in project hazelcast by hazelcast.
the class DynamicConfigBouncingTest method createMapConfig.
private static MapConfig createMapConfig(String mapName) {
NearCacheConfig nearCacheConfig = new NearCacheConfig().setCacheLocalEntries(true).setInMemoryFormat(InMemoryFormat.NATIVE).setLocalUpdatePolicy(NearCacheConfig.LocalUpdatePolicy.CACHE_ON_UPDATE).setPreloaderConfig(new NearCachePreloaderConfig().setEnabled(true));
HotRestartConfig hotRestartConfig = new HotRestartConfig().setEnabled(true).setFsync(true);
EvictionConfig evictionConfig = new EvictionConfig();
evictionConfig.setSize(1000).setMaxSizePolicy(MaxSizePolicy.FREE_HEAP_SIZE).setComparator(new LRUEvictionPolicyComparator());
MapStoreConfig mapStoreConfig = new MapStoreConfig().setEnabled(true).setClassName("foo.bar.MapStoreDoesNotExist");
WanReplicationRef wanRef = new WanReplicationRef("name", "foo.bar.PolicyClass", Collections.<String>emptyList(), true);
EntryListenerConfig classEntryListener = new EntryListenerConfig("foo.bar.ClassName", true, true);
EntryListenerConfig entryListener = new EntryListenerConfig(new MyEntryListener(), true, true);
EntryListenerConfig mapListener = new EntryListenerConfig(new MyEntryUpdatedListener(), true, true);
QueryCacheConfig queryCacheConfig = new QueryCacheConfig("queryCacheName").setBatchSize(100).addIndexConfig(new IndexConfig(IndexType.HASH, "attribute")).addEntryListenerConfig(new EntryListenerConfig("foo.bar.Classname", false, true)).setInMemoryFormat(InMemoryFormat.OBJECT);
return new MapConfig(mapName).setBackupCount(2).setBackupCount(3).setTimeToLiveSeconds(12).setMaxIdleSeconds(20).setNearCacheConfig(nearCacheConfig).setReadBackupData(true).setCacheDeserializedValues(CacheDeserializedValues.ALWAYS).setInMemoryFormat(InMemoryFormat.OBJECT).setHotRestartConfig(hotRestartConfig).setEvictionConfig(evictionConfig).setMapStoreConfig(mapStoreConfig).setWanReplicationRef(wanRef).addEntryListenerConfig(classEntryListener).addEntryListenerConfig(entryListener).addEntryListenerConfig(mapListener).addMapPartitionLostListenerConfig(new MapPartitionLostListenerConfig("foo.bar.Classname")).addIndexConfig(new IndexConfig(IndexType.SORTED, "orderAttribute")).addIndexConfig(new IndexConfig(IndexType.HASH, "unorderedAttribute")).addAttributeConfig(new AttributeConfig("attribute", "foo.bar.ExtractorClass")).addQueryCacheConfig(queryCacheConfig).setStatisticsEnabled(false).setPerEntryStatsEnabled(true).setPartitioningStrategyConfig(new PartitioningStrategyConfig("foo.bar.Class")).setSplitBrainProtectionName("split-brain-protection");
}
use of com.hazelcast.config.HotRestartConfig in project hazelcast by hazelcast.
the class CacheConfigHelper method newCompleteCacheConfig.
public static CacheConfig newCompleteCacheConfig(String name) {
CacheConfig cacheConfig = new CacheConfig();
cacheConfig.setName(name);
cacheConfig.setSplitBrainProtectionName("split-brain-protection");
cacheConfig.setInMemoryFormat(InMemoryFormat.OBJECT);
cacheConfig.setBackupCount(3);
cacheConfig.setAsyncBackupCount(2);
cacheConfig.setWanReplicationRef(new WanReplicationRef(randomName(), "com.hazelcast.MergePolicy", Collections.singletonList("filter"), true));
cacheConfig.addCacheEntryListenerConfiguration(new MutableCacheEntryListenerConfiguration(new CacheConfigTest.EntryListenerFactory(), null, false, true));
cacheConfig.getMergePolicyConfig().setPolicy("mergePolicy");
cacheConfig.setStatisticsEnabled(true);
cacheConfig.setManagementEnabled(true);
cacheConfig.setDisablePerEntryInvalidationEvents(true);
cacheConfig.setKeyClassName("java.lang.Integer");
cacheConfig.setValueClassName("java.lang.String");
cacheConfig.setReadThrough(true);
cacheConfig.setWriteThrough(true);
cacheConfig.setHotRestartConfig(new HotRestartConfig().setEnabled(true).setFsync(true));
return cacheConfig;
}
Aggregations