Search in sources :

Example 6 with InMemoryFormat

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);
}
Also used : MergePolicyConfig(com.hazelcast.config.MergePolicyConfig) Node(org.w3c.dom.Node) RingbufferStoreConfig(com.hazelcast.config.RingbufferStoreConfig) InMemoryFormat(com.hazelcast.config.InMemoryFormat)

Example 7 with InMemoryFormat

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);
    }
}
Also used : InMemoryFormat(com.hazelcast.config.InMemoryFormat)

Example 8 with 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;
        }
    };
}
Also used : AbstractReplicatedRecordStore(com.hazelcast.replicatedmap.impl.record.AbstractReplicatedRecordStore) ReplicatedMapConfig(com.hazelcast.config.ReplicatedMapConfig) ObjectReplicatedRecordStorage(com.hazelcast.replicatedmap.impl.record.ObjectReplicatedRecordStorage) ConstructorFunction(com.hazelcast.util.ConstructorFunction) InMemoryFormat(com.hazelcast.config.InMemoryFormat) DataReplicatedRecordStore(com.hazelcast.replicatedmap.impl.record.DataReplicatedRecordStore)

Example 9 with InMemoryFormat

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;
}
Also used : InMemoryFormat(com.hazelcast.config.InMemoryFormat)

Example 10 with InMemoryFormat

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);
}
Also used : LocalMapStatsImpl(com.hazelcast.internal.monitor.impl.LocalMapStatsImpl) MapConfig(com.hazelcast.config.MapConfig) InMemoryFormat(com.hazelcast.config.InMemoryFormat)

Aggregations

InMemoryFormat (com.hazelcast.config.InMemoryFormat)14 MapConfig (com.hazelcast.config.MapConfig)5 Config (com.hazelcast.config.Config)2 BINARY (com.hazelcast.config.InMemoryFormat.BINARY)2 NATIVE (com.hazelcast.config.InMemoryFormat.NATIVE)2 OBJECT (com.hazelcast.config.InMemoryFormat.OBJECT)2 IndexConfig (com.hazelcast.config.IndexConfig)2 IndexType (com.hazelcast.config.IndexType)2 MapStoreConfig (com.hazelcast.config.MapStoreConfig)2 EntryView (com.hazelcast.core.EntryView)2 HazelcastInstance (com.hazelcast.core.HazelcastInstance)2 HazelcastInstanceAware (com.hazelcast.core.HazelcastInstanceAware)2 HazelcastJsonValue (com.hazelcast.core.HazelcastJsonValue)2 Offloadable (com.hazelcast.core.Offloadable)2 ReadOnly (com.hazelcast.core.ReadOnly)2 Json (com.hazelcast.internal.json.Json)2 JsonValue (com.hazelcast.internal.json.JsonValue)2 Data (com.hazelcast.internal.serialization.Data)2 DefaultSerializationServiceBuilder (com.hazelcast.internal.serialization.impl.DefaultSerializationServiceBuilder)2 PREDICATE_APPLY_COUNT (com.hazelcast.map.EntryProcessorTest.ApplyCountAwareIndexedTestPredicate.PREDICATE_APPLY_COUNT)2