use of com.hazelcast.spi.serialization.SerializationService in project hazelcast by hazelcast.
the class AbstractCallableTaskOperation method getManagedContext.
private ManagedContext getManagedContext() {
HazelcastInstanceImpl hazelcastInstance = (HazelcastInstanceImpl) getNodeEngine().getHazelcastInstance();
SerializationService serializationService = hazelcastInstance.getSerializationService();
return serializationService.getManagedContext();
}
use of com.hazelcast.spi.serialization.SerializationService in project hazelcast by hazelcast.
the class EntryBackupOperation method run.
@Override
public void run() {
boolean shouldClone = mapContainer.shouldCloneOnEntryProcessing();
SerializationService serializationService = getNodeEngine().getSerializationService();
oldValue = recordStore.get(dataKey, true);
Object value = shouldClone ? serializationService.toObject(serializationService.toData(oldValue)) : oldValue;
Map.Entry entry = createMapEntry(dataKey, value);
entryProcessor.processBackup(entry);
if (noOpBackup(entry)) {
return;
}
if (entryRemovedBackup(entry)) {
return;
}
entryAddedOrUpdatedBackup(entry);
}
use of com.hazelcast.spi.serialization.SerializationService in project hazelcast by hazelcast.
the class EntryOperation method run.
@Override
public void run() {
final long now = getNow();
boolean shouldClone = mapContainer.shouldCloneOnEntryProcessing();
SerializationService serializationService = getNodeEngine().getSerializationService();
oldValue = recordStore.get(dataKey, false);
Object value = shouldClone ? serializationService.toObject(serializationService.toData(oldValue)) : oldValue;
Map.Entry entry = createMapEntry(dataKey, value);
response = process(entry);
// first call noOp, other if checks below depends on it.
if (noOp(entry)) {
return;
}
if (entryRemoved(entry, now)) {
return;
}
entryAddedOrUpdated(entry, now);
}
use of com.hazelcast.spi.serialization.SerializationService in project hazelcast by hazelcast.
the class MapDataStores method createWriteThroughStore.
/**
* Creates a write through data store.
*
* @param mapStoreContext context for map store operations.
* @param <K> type of key to store.
* @param <V> type of value to store.
* @return new write through store manager.
*/
public static <K, V> MapDataStore<K, V> createWriteThroughStore(MapStoreContext mapStoreContext) {
final MapStoreWrapper store = mapStoreContext.getMapStoreWrapper();
final MapServiceContext mapServiceContext = mapStoreContext.getMapServiceContext();
final NodeEngine nodeEngine = mapServiceContext.getNodeEngine();
final SerializationService serializationService = nodeEngine.getSerializationService();
return (MapDataStore<K, V>) new WriteThroughStore(store, serializationService);
}
use of com.hazelcast.spi.serialization.SerializationService in project hazelcast by hazelcast.
the class NearCacheLiteMemberTest method testPutAll.
public static void testPutAll(HazelcastInstance instance, HazelcastInstance lite, String mapName) {
IMap<Object, Object> map = instance.getMap(mapName);
IMap<Object, Object> liteMap = lite.getMap(mapName);
NearCachedMapProxyImpl proxy = (NearCachedMapProxyImpl) liteMap;
NearCache liteNearCache = proxy.getNearCache();
SerializationService serializationService = ((SerializationServiceSupport) instance).getSerializationService();
int count = 100;
// fill the near cache with the same data as below so we can detect when it is emptied
for (int i = 0; i < count; i++) {
liteNearCache.put(serializationService.toData(i), i);
}
final NearCacheStats stats = liteNearCache.getNearCacheStats();
assertEquals(100, stats.getOwnedEntryCount());
Map<Object, Object> localMap = new HashMap<Object, Object>();
for (int i = 0; i < count; i++) {
localMap.put(i, i);
}
map.putAll(localMap);
assertTrueEventually(new AssertTask() {
@Override
public void run() throws Exception {
assertEquals(0, stats.getOwnedEntryCount());
}
});
for (int i = 0; i < count; i++) {
liteMap.get(i);
}
assertLiteMemberNearCacheNonEmpty(lite, mapName);
}
Aggregations