use of com.hazelcast.nio.serialization.Data in project hazelcast by hazelcast.
the class PutBackupOperation method publishWANReplicationEventBackup.
private void publishWANReplicationEventBackup(MapServiceContext mapServiceContext, MapEventPublisher mapEventPublisher) {
if (!mapContainer.isWanReplicationEnabled()) {
return;
}
Record record = recordStore.getRecord(dataKey);
if (record == null) {
return;
}
final Data valueConvertedData = mapServiceContext.toData(dataValue);
final EntryView entryView = EntryViews.createSimpleEntryView(dataKey, valueConvertedData, record);
mapEventPublisher.publishWanReplicationUpdateBackup(name, entryView);
}
use of com.hazelcast.nio.serialization.Data in project hazelcast by hazelcast.
the class MultipleEntryBackupOperation method writeInternal.
@Override
protected void writeInternal(ObjectDataOutput out) throws IOException {
super.writeInternal(out);
out.writeObject(backupProcessor);
out.writeInt(keys.size());
for (Data key : keys) {
out.writeData(key);
}
}
use of com.hazelcast.nio.serialization.Data in project hazelcast by hazelcast.
the class MultipleEntryBackupOperation method readInternal.
@Override
protected void readInternal(ObjectDataInput in) throws IOException {
super.readInternal(in);
backupProcessor = in.readObject();
int size = in.readInt();
keys = new LinkedHashSet<Data>(size);
for (int i = 0; i < size; i++) {
Data key = in.readData();
keys.add(key);
}
}
use of com.hazelcast.nio.serialization.Data in project hazelcast by hazelcast.
the class MultipleEntryOperation method run.
@Override
@SuppressWarnings("checkstyle:npathcomplexity")
public void run() throws Exception {
long now = getNow();
boolean shouldClone = mapContainer.shouldCloneOnEntryProcessing();
SerializationService serializationService = getNodeEngine().getSerializationService();
responses = new MapEntries(keys.size());
for (Data key : keys) {
if (!isKeyProcessable(key)) {
continue;
}
Object oldValue = recordStore.get(key, false);
Object value = shouldClone ? serializationService.toObject(serializationService.toData(oldValue)) : oldValue;
Map.Entry entry = createMapEntry(key, value);
if (!isEntryProcessable(entry)) {
continue;
}
Data response = process(entry);
if (response != null) {
responses.add(key, response);
}
// first call noOp, other if checks below depends on it.
if (noOp(entry, oldValue, now)) {
continue;
}
if (entryRemoved(entry, key, oldValue, now)) {
continue;
}
entryAddedOrUpdated(entry, key, oldValue, now);
evict(key);
}
}
use of com.hazelcast.nio.serialization.Data in project hazelcast by hazelcast.
the class MapProxySupport method getPartitionsForKeys.
private Collection<Integer> getPartitionsForKeys(Collection<Data> keys) {
int partitions = partitionService.getPartitionCount();
// TODO: is there better way to estimate the size?
int capacity = min(partitions, keys.size());
Set<Integer> partitionIds = new HashSet<Integer>(capacity);
Iterator<Data> iterator = keys.iterator();
while (iterator.hasNext() && partitionIds.size() < partitions) {
Data key = iterator.next();
partitionIds.add(partitionService.getPartitionId(key));
}
return partitionIds;
}
Aggregations