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();
}
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;
}
}
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;
}
}
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;
}
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);
}
Aggregations