use of com.hazelcast.config.CachePartitionLostListenerConfig 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;
}
use of com.hazelcast.config.CachePartitionLostListenerConfig in project hazelcast by hazelcast.
the class AbstractDynamicConfigGeneratorTest method testCacheAttributes.
// CACHE
@Test
public void testCacheAttributes() {
CacheSimpleConfig expectedConfig = new CacheSimpleConfig().setName("testCache").setEvictionConfig(evictionConfig()).setInMemoryFormat(InMemoryFormat.OBJECT).setBackupCount(2).setAsyncBackupCount(3).setCacheLoader("cacheLoader").setCacheWriter("cacheWriter").setExpiryPolicyFactoryConfig(new CacheSimpleConfig.ExpiryPolicyFactoryConfig("expiryPolicyFactory")).setManagementEnabled(true).setStatisticsEnabled(true).setKeyType("keyType").setValueType("valueType").setReadThrough(true).setDataPersistenceConfig(dataPersistenceConfig()).setEventJournalConfig(eventJournalConfig()).setCacheEntryListeners(singletonList(cacheSimpleEntryListenerConfig())).setWriteThrough(true).setPartitionLostListenerConfigs(singletonList(new CachePartitionLostListenerConfig("partitionLostListener"))).setSplitBrainProtectionName("testSplitBrainProtection");
expectedConfig.getMergePolicyConfig().setPolicy("HigherHitsMergePolicy").setBatchSize(99);
expectedConfig.setDisablePerEntryInvalidationEvents(true);
expectedConfig.setWanReplicationRef(wanReplicationRef());
Config config = new Config().addCacheConfig(expectedConfig);
Config decConfig = getNewConfigViaGenerator(config);
CacheSimpleConfig actualConfig = decConfig.getCacheConfig("testCache");
assertEquals(expectedConfig, actualConfig);
}
use of com.hazelcast.config.CachePartitionLostListenerConfig in project hazelcast by hazelcast.
the class DynamicConfigTest method testCacheConfig_withPartitionLostListenerByImplementation.
@Test
public void testCacheConfig_withPartitionLostListenerByImplementation() {
CacheSimpleConfig config = getCacheConfig().addCachePartitionLostListenerConfig(new CachePartitionLostListenerConfig(new SampleCachePartitionLostListener()));
driver.getConfig().addCacheConfig(config);
assertConfigurationsEqualOnAllMembers(config);
}
use of com.hazelcast.config.CachePartitionLostListenerConfig in project hazelcast by hazelcast.
the class DynamicConfigTest method testCacheConfig_withPartitionLostListenerByClassName.
@Test
public void testCacheConfig_withPartitionLostListenerByClassName() {
CacheSimpleConfig config = getCacheConfig().addCachePartitionLostListenerConfig(new CachePartitionLostListenerConfig("partitionLostListener"));
driver.getConfig().addCacheConfig(config);
assertConfigurationsEqualOnAllMembers(config);
}
use of com.hazelcast.config.CachePartitionLostListenerConfig in project hazelcast by hazelcast.
the class CachePartitionLostListenerConfigTest method testGetImplementation.
@Test
public void testGetImplementation() {
CachePartitionLostListener listener = new EventCollectingCachePartitionLostListener(0);
CachePartitionLostListenerConfig listenerConfig = new CachePartitionLostListenerConfig(listener);
assertEquals(listener, listenerConfig.getImplementation());
}
Aggregations