use of com.hazelcast.config.InMemoryFormat 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);
}
use of com.hazelcast.config.InMemoryFormat in project hazelcast by hazelcast.
the class NearCacheTestUtils method assertNearCacheContent.
/**
* Asserts the values of the Near Cache itself.
*
* @param context the {@link NearCacheTestContext} to retrieve the Near Cache from
* @param size the number of entries to check
*/
public static void assertNearCacheContent(NearCacheTestContext<?, ?, ?, ?> context, int size) {
InMemoryFormat inMemoryFormat = context.nearCacheConfig.getInMemoryFormat();
for (int i = 0; i < size; i++) {
Object nearCacheKey = getNearCacheKey(context, i);
String value = context.serializationService.toObject(getValueFromNearCache(context, nearCacheKey));
assertEquals("value-" + i, value);
assertNearCacheRecord(getRecordFromNearCache(context, nearCacheKey), i, inMemoryFormat);
}
}
use of com.hazelcast.config.InMemoryFormat in project hazelcast by hazelcast.
the class PartitionContainer method buildConstructorFunction.
private ConstructorFunction<String, ReplicatedRecordStore> buildConstructorFunction() {
return new ConstructorFunction<String, ReplicatedRecordStore>() {
@Override
public ReplicatedRecordStore createNew(String name) {
ReplicatedMapConfig replicatedMapConfig = service.getReplicatedMapConfig(name);
InMemoryFormat inMemoryFormat = replicatedMapConfig.getInMemoryFormat();
AbstractReplicatedRecordStore replicatedRecordStorage = null;
switch(inMemoryFormat) {
case OBJECT:
replicatedRecordStorage = new ObjectReplicatedRecordStorage(name, service, partitionId);
break;
case BINARY:
replicatedRecordStorage = new DataReplicatedRecordStore(name, service, partitionId);
break;
case NATIVE:
throw new IllegalStateException("Native memory not yet supported for replicated map");
default:
throw new IllegalStateException("Unhandled in memory format:" + inMemoryFormat);
}
return replicatedRecordStorage;
}
};
}
use of com.hazelcast.config.InMemoryFormat in project hazelcast by hazelcast.
the class NearCachedClientCacheProxy method checkNearCacheConfig.
private static NearCacheConfig checkNearCacheConfig(NearCacheConfig nearCacheConfig, NativeMemoryConfig nativeMemoryConfig) {
InMemoryFormat inMemoryFormat = nearCacheConfig.getInMemoryFormat();
if (inMemoryFormat != NATIVE) {
return nearCacheConfig;
}
checkTrue(nativeMemoryConfig.isEnabled(), "Enable native memory config to use NATIVE in-memory-format for Near Cache");
return nearCacheConfig;
}
use of com.hazelcast.config.InMemoryFormat in project hazelcast by hazelcast.
the class LocalMapStatsProvider method createLocalMapStatsImpl.
private LocalMapStatsImpl createLocalMapStatsImpl(String mapName) {
// intentionally not using nodeEngine.getConfig().getMapConfig(mapName)
// since that breaks TestFullApplicationContext#testMapConfig()
MapConfig mapConfig = nodeEngine.getConfig().getMapConfigs().get(mapName);
InMemoryFormat inMemoryFormat;
if (mapConfig == null) {
inMemoryFormat = InMemoryFormat.BINARY;
} else {
inMemoryFormat = mapConfig.getInMemoryFormat();
}
return new LocalMapStatsImpl(inMemoryFormat == OBJECT);
}
Aggregations