Search in sources :

Example 1 with InMemoryFormat

use of com.hazelcast.config.InMemoryFormat in project hazelcast by hazelcast.

the class AbstractMultipleEntryOperation method nullifyOldValueIfNecessary.

/**
     * Nullify old value if in memory format is object and operation is not removal
     * since old and new value in fired event {@link com.hazelcast.core.EntryEvent}
     * may be same due to the object in memory format.
     */
protected Object nullifyOldValueIfNecessary(Object oldValue, EntryEventType eventType) {
    final MapConfig mapConfig = mapContainer.getMapConfig();
    final InMemoryFormat format = mapConfig.getInMemoryFormat();
    if (format == InMemoryFormat.OBJECT && eventType != EntryEventType.REMOVED) {
        return null;
    } else {
        return oldValue;
    }
}
Also used : MapConfig(com.hazelcast.config.MapConfig) InMemoryFormat(com.hazelcast.config.InMemoryFormat)

Example 2 with InMemoryFormat

use of com.hazelcast.config.InMemoryFormat in project hazelcast by hazelcast.

the class EntryOperation method nullifyOldValueIfNecessary.

/**
     * Nullify old value if in memory format is object and operation is not removal
     * since old and new value in fired event {@link com.hazelcast.core.EntryEvent}
     * may be same due to the object in memory format.
     */
private void nullifyOldValueIfNecessary() {
    final MapConfig mapConfig = mapContainer.getMapConfig();
    final InMemoryFormat format = mapConfig.getInMemoryFormat();
    if (format == InMemoryFormat.OBJECT && eventType != REMOVED) {
        oldValue = null;
    }
}
Also used : MapConfig(com.hazelcast.config.MapConfig) InMemoryFormat(com.hazelcast.config.InMemoryFormat)

Example 3 with InMemoryFormat

use of com.hazelcast.config.InMemoryFormat in project hazelcast by hazelcast.

the class AbstractClientInternalCacheProxy method checkNearCacheConfig.

private static void checkNearCacheConfig(NearCacheConfig nearCacheConfig, NativeMemoryConfig nativeMemoryConfig) {
    InMemoryFormat inMemoryFormat = nearCacheConfig.getInMemoryFormat();
    if (inMemoryFormat != NATIVE) {
        return;
    }
    checkTrue(nativeMemoryConfig.isEnabled(), "Enable native memory config to use NATIVE in-memory-format for Near Cache");
}
Also used : InMemoryFormat(com.hazelcast.config.InMemoryFormat)

Example 4 with InMemoryFormat

use of com.hazelcast.config.InMemoryFormat in project hazelcast by hazelcast.

the class ConfigValidator method checkOnHeapNearCacheMaxSizePolicy.

private static void checkOnHeapNearCacheMaxSizePolicy(NearCacheConfig nearCacheConfig) {
    InMemoryFormat inMemoryFormat = nearCacheConfig.getInMemoryFormat();
    if (inMemoryFormat == NATIVE) {
        return;
    }
    MaxSizePolicy maxSizePolicy = nearCacheConfig.getEvictionConfig().getMaxSizePolicy();
    if (!NEAR_CACHE_SUPPORTED_ON_HEAP_MAX_SIZE_POLICIES.contains(maxSizePolicy)) {
        throw new InvalidConfigurationException(format("Near Cache maximum size policy %s cannot be used with %s storage." + " Supported maximum size policies are: %s", maxSizePolicy, inMemoryFormat, NEAR_CACHE_SUPPORTED_ON_HEAP_MAX_SIZE_POLICIES));
    }
}
Also used : MaxSizePolicy(com.hazelcast.config.MaxSizePolicy) InMemoryFormat(com.hazelcast.config.InMemoryFormat) InvalidConfigurationException(com.hazelcast.config.InvalidConfigurationException)

Example 5 with InMemoryFormat

use of com.hazelcast.config.InMemoryFormat in project hazelcast by hazelcast.

the class AbstractCacheMessageTask method getOperationProvider.

protected CacheOperationProvider getOperationProvider(String name) {
    ICacheService service = getService(CacheService.SERVICE_NAME);
    final CacheConfig cacheConfig = service.getCacheConfig(name);
    if (cacheConfig == null) {
        throw new CacheNotExistsException("Cache " + name + " is already destroyed or not created yet, on " + nodeEngine.getLocalMember());
    }
    final InMemoryFormat inMemoryFormat = cacheConfig.getInMemoryFormat();
    return service.getCacheOperationProvider(name, inMemoryFormat);
}
Also used : ICacheService(com.hazelcast.cache.impl.ICacheService) CacheConfig(com.hazelcast.config.CacheConfig) CacheNotExistsException(com.hazelcast.cache.CacheNotExistsException) 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