use of com.hazelcast.config.EventJournalConfig in project hazelcast by hazelcast.
the class ExternalMemberConfigurationOverrideEnvTest method shouldHandleMapEventJournalConfig.
@Test
public void shouldHandleMapEventJournalConfig() throws Exception {
Config config = new Config();
EventJournalConfig eventJournalConfig = new EventJournalConfig().setEnabled(false).setCapacity(10);
config.getMapConfig("foo1").setBackupCount(4).setEventJournalConfig(eventJournalConfig);
Map<String, String> envVariables = new HashMap<>();
envVariables.put("HZ_MAP_FOO1_BACKUPCOUNT", "2");
envVariables.put("HZ_MAP_FOO1_EVENTJOURNAL_ENABLED", "true");
new ExternalConfigurationOverride(envVariables, System::getProperties).overwriteMemberConfig(config);
assertEquals(2, config.getMapConfig("foo1").getBackupCount());
assertTrue(config.getMapConfig("foo1").getEventJournalConfig().isEnabled());
assertEquals(10, config.getMapConfig("foo1").getEventJournalConfig().getCapacity());
}
use of com.hazelcast.config.EventJournalConfig in project hazelcast by hazelcast.
the class DynamicConfigTest method getCacheConfig.
private CacheSimpleConfig getCacheConfig() {
CacheSimpleEntryListenerConfig entryListenerConfig = new CacheSimpleEntryListenerConfig();
entryListenerConfig.setCacheEntryListenerFactory("CacheEntryListenerFactory");
entryListenerConfig.setSynchronous(true);
entryListenerConfig.setOldValueRequired(true);
entryListenerConfig.setCacheEntryEventFilterFactory("CacheEntryEventFilterFactory");
CacheSimpleConfig config = new CacheSimpleConfig().setName(name).setSplitBrainProtectionName("split-brain-protection").setInMemoryFormat(InMemoryFormat.OBJECT).setBackupCount(3).setAsyncBackupCount(2).addEntryListenerConfig(entryListenerConfig).setStatisticsEnabled(true).setManagementEnabled(true).setKeyType("keyType").setValueType("valueType").setReadThrough(true).setWriteThrough(true).setHotRestartConfig(new HotRestartConfig().setEnabled(true).setFsync(true)).setEventJournalConfig(new EventJournalConfig().setEnabled(true).setCapacity(42).setTimeToLiveSeconds(52));
config.setWanReplicationRef(new WanReplicationRef(randomName(), "com.hazelcast.MergePolicy", Collections.singletonList("filter"), true));
config.getMergePolicyConfig().setPolicy("mergePolicy");
config.setDisablePerEntryInvalidationEvents(true);
return config;
}
use of com.hazelcast.config.EventJournalConfig in project hazelcast by hazelcast.
the class DynamicConfigTest method getMapConfig.
private MapConfig getMapConfig() {
MapConfig mapConfig = new MapConfig(name);
mapConfig.setAsyncBackupCount(3).setBackupCount(2).setCacheDeserializedValues(CacheDeserializedValues.ALWAYS).setMerkleTreeConfig(new MerkleTreeConfig().setEnabled(true).setDepth(15)).setEventJournalConfig(new EventJournalConfig().setEnabled(true).setCapacity(42).setTimeToLiveSeconds(52)).setHotRestartConfig(new HotRestartConfig().setEnabled(true).setFsync(true)).setInMemoryFormat(InMemoryFormat.OBJECT).setMergePolicyConfig(new MergePolicyConfig(NON_DEFAULT_MERGE_POLICY, NON_DEFAULT_MERGE_BATCH_SIZE)).setTimeToLiveSeconds(220).setMaxIdleSeconds(110).setSplitBrainProtectionName(randomString()).addAttributeConfig(new AttributeConfig("attributeName", "com.attribute.extractor")).addIndexConfig(new IndexConfig(IndexType.SORTED, "attr")).setMetadataPolicy(MetadataPolicy.OFF).setReadBackupData(true).setStatisticsEnabled(false).setPerEntryStatsEnabled(true);
mapConfig.getEvictionConfig().setEvictionPolicy(EvictionPolicy.RANDOM).setSize(4096).setMaxSizePolicy(MaxSizePolicy.PER_NODE);
return mapConfig;
}
use of com.hazelcast.config.EventJournalConfig in project hazelcast by hazelcast.
the class RingbufferCacheEventJournalImpl method getEventJournalConfig.
/**
* {@inheritDoc}
*
* @throws CacheNotExistsException if the cache configuration was not found
*/
@Override
public EventJournalConfig getEventJournalConfig(ObjectNamespace namespace) {
String name = namespace.getObjectName();
CacheConfig cacheConfig = getCacheService().getCacheConfig(name);
if (cacheConfig == null) {
throw new CacheNotExistsException("Cache " + name + " is already destroyed or not created yet, on " + nodeEngine.getLocalMember());
}
EventJournalConfig config = cacheConfig.getEventJournalConfig();
if (config == null || !config.isEnabled()) {
return null;
}
return config;
}
use of com.hazelcast.config.EventJournalConfig in project hazelcast by hazelcast.
the class RingbufferMapEventJournalImpl method getRingbufferOrNull.
private RingbufferContainer<InternalEventJournalMapEvent, Object> getRingbufferOrNull(ObjectNamespace namespace, int partitionId) {
RingbufferService service = getRingbufferService();
RingbufferConfig ringbufferConfig;
RingbufferContainer<InternalEventJournalMapEvent, Object> container = service.getContainerOrNull(partitionId, namespace);
if (container != null) {
return container;
}
EventJournalConfig config = getEventJournalConfig(namespace);
if (config == null || !config.isEnabled()) {
return null;
}
ringbufferConfig = toRingbufferConfig(config, namespace);
return service.getOrCreateContainer(partitionId, namespace, ringbufferConfig);
}
Aggregations