use of com.hazelcast.cache.impl.record.CacheRecord in project hazelcast by hazelcast.
the class CachePutAllBackupOperation method writeInternal.
@Override
protected void writeInternal(ObjectDataOutput out) throws IOException {
super.writeInternal(out);
out.writeBoolean(cacheRecords != null);
if (cacheRecords != null) {
out.writeInt(cacheRecords.size());
for (Map.Entry<Data, CacheRecord> entry : cacheRecords.entrySet()) {
final Data key = entry.getKey();
final CacheRecord record = entry.getValue();
out.writeData(key);
out.writeObject(record);
}
}
}
use of com.hazelcast.cache.impl.record.CacheRecord in project hazelcast by hazelcast.
the class CachePutAllBackupOperation method readInternal.
@Override
protected void readInternal(ObjectDataInput in) throws IOException {
super.readInternal(in);
final boolean recordNotNull = in.readBoolean();
if (recordNotNull) {
int size = in.readInt();
cacheRecords = new HashMap<Data, CacheRecord>(size);
for (int i = 0; i < size; i++) {
final Data key = in.readData();
final CacheRecord record = in.readObject();
cacheRecords.put(key, record);
}
}
}
use of com.hazelcast.cache.impl.record.CacheRecord in project hazelcast by hazelcast.
the class CacheSerializationTest method testCacheRecord_withObjectInMemoryData.
@Test
public void testCacheRecord_withObjectInMemoryData() {
String value = randomString();
CacheRecord cacheRecord = createRecord(InMemoryFormat.OBJECT, value);
Data cacheRecordData = service.toData(cacheRecord);
CacheRecord deserialized = service.toObject(cacheRecordData);
assertEquals(value, deserialized.getValue());
}
use of com.hazelcast.cache.impl.record.CacheRecord in project hazelcast by hazelcast.
the class CacheSerializationTest method testCacheRecord_withBinaryInMemoryData.
@Test
public void testCacheRecord_withBinaryInMemoryData() {
String value = randomString();
CacheRecord cacheRecord = createRecord(InMemoryFormat.BINARY, value);
Data cacheRecordData = service.toData(cacheRecord);
CacheRecord deserialized = service.toObject(cacheRecordData);
assertEquals(value, service.toObject(deserialized.getValue()));
}
Aggregations