Search in sources :

Example 21 with MapConfig

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

the class WriteBehindStore method getInMemoryFormat.

private static InMemoryFormat getInMemoryFormat(MapStoreContext mapStoreContext) {
    MapServiceContext mapServiceContext = mapStoreContext.getMapServiceContext();
    NodeEngine nodeEngine = mapServiceContext.getNodeEngine();
    Config config = nodeEngine.getConfig();
    String mapName = mapStoreContext.getMapName();
    MapConfig mapConfig = config.findMapConfig(mapName);
    return mapConfig.getInMemoryFormat();
}
Also used : NodeEngine(com.hazelcast.spi.NodeEngine) MapConfig(com.hazelcast.config.MapConfig) Config(com.hazelcast.config.Config) MapStoreConfig(com.hazelcast.config.MapStoreConfig) MapConfig(com.hazelcast.config.MapConfig) MapServiceContext(com.hazelcast.map.impl.MapServiceContext)

Example 22 with MapConfig

use of com.hazelcast.config.MapConfig 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 23 with MapConfig

use of com.hazelcast.config.MapConfig 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 24 with MapConfig

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

the class BasicMapStoreContext method create.

static MapStoreContext create(MapContainer mapContainer) {
    final BasicMapStoreContext context = new BasicMapStoreContext();
    final String mapName = mapContainer.getName();
    final MapServiceContext mapServiceContext = mapContainer.getMapServiceContext();
    final NodeEngine nodeEngine = mapServiceContext.getNodeEngine();
    final PartitioningStrategy partitioningStrategy = mapContainer.getPartitioningStrategy();
    final MapConfig mapConfig = mapContainer.getMapConfig();
    final MapStoreConfig mapStoreConfig = mapConfig.getMapStoreConfig();
    final ClassLoader configClassLoader = nodeEngine.getConfigClassLoader();
    // create store.
    final Object store = createStore(mapName, mapStoreConfig, configClassLoader);
    final MapStoreWrapper storeWrapper = new MapStoreWrapper(mapName, store);
    storeWrapper.instrument(nodeEngine);
    setStoreImplToWritableMapStoreConfig(nodeEngine, mapName, store);
    context.setMapName(mapName);
    context.setMapStoreConfig(mapStoreConfig);
    context.setPartitioningStrategy(partitioningStrategy);
    context.setMapServiceContext(mapServiceContext);
    context.setStoreWrapper(storeWrapper);
    final MapStoreManager mapStoreManager = createMapStoreManager(context);
    context.setMapStoreManager(mapStoreManager);
    // todo this is user code. it may also block map store creation.
    callLifecycleSupportInit(context);
    return context;
}
Also used : NodeEngine(com.hazelcast.spi.NodeEngine) MapStoreWrapper(com.hazelcast.map.impl.MapStoreWrapper) PartitioningStrategy(com.hazelcast.core.PartitioningStrategy) MapConfig(com.hazelcast.config.MapConfig) MapStoreConfig(com.hazelcast.config.MapStoreConfig) MapServiceContext(com.hazelcast.map.impl.MapServiceContext)

Example 25 with MapConfig

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

the class MapStoreContextFactory method createMapStoreContext.

public static MapStoreContext createMapStoreContext(MapContainer mapContainer) {
    final MapConfig mapConfig = mapContainer.getMapConfig();
    final MapStoreConfig mapStoreConfig = mapConfig.getMapStoreConfig();
    if (mapStoreConfig == null || !mapStoreConfig.isEnabled()) {
        return EMPTY_MAP_STORE_CONTEXT;
    }
    return BasicMapStoreContext.create(mapContainer);
}
Also used : MapConfig(com.hazelcast.config.MapConfig) MapStoreConfig(com.hazelcast.config.MapStoreConfig)

Aggregations

MapConfig (com.hazelcast.config.MapConfig)178 Config (com.hazelcast.config.Config)123 HazelcastInstance (com.hazelcast.core.HazelcastInstance)78 Test (org.junit.Test)75 QuickTest (com.hazelcast.test.annotation.QuickTest)68 ParallelTest (com.hazelcast.test.annotation.ParallelTest)62 MapStoreConfig (com.hazelcast.config.MapStoreConfig)43 TestHazelcastInstanceFactory (com.hazelcast.test.TestHazelcastInstanceFactory)41 NearCacheConfig (com.hazelcast.config.NearCacheConfig)27 MaxSizeConfig (com.hazelcast.config.MaxSizeConfig)26 MapIndexConfig (com.hazelcast.config.MapIndexConfig)20 QuorumConfig (com.hazelcast.config.QuorumConfig)19 EntryListenerConfig (com.hazelcast.config.EntryListenerConfig)18 QueryCacheConfig (com.hazelcast.config.QueryCacheConfig)16 AtomicInteger (java.util.concurrent.atomic.AtomicInteger)14 NightlyTest (com.hazelcast.test.annotation.NightlyTest)12 PartitionedCluster (com.hazelcast.quorum.PartitionedCluster)10 CountDownLatch (java.util.concurrent.CountDownLatch)10 BeforeClass (org.junit.BeforeClass)10 AssertTask (com.hazelcast.test.AssertTask)9