use of com.hazelcast.map.impl.MapEntries in project hazelcast by hazelcast.
the class PartitionWideEntryOperation method run.
@Override
public void run() {
long now = getNow();
boolean shouldClone = mapContainer.shouldCloneOnEntryProcessing();
SerializationService serializationService = getNodeEngine().getSerializationService();
responses = new MapEntries(recordStore.size());
Iterator<Record> iterator = recordStore.iterator(now, false);
while (iterator.hasNext()) {
Record record = iterator.next();
Data dataKey = record.getKey();
Object oldValue = record.getValue();
Object value = shouldClone ? serializationService.toObject(serializationService.toData(oldValue)) : oldValue;
if (!applyPredicate(dataKey, value)) {
continue;
}
Map.Entry entry = createMapEntry(dataKey, value);
Data response = process(entry);
if (response != null) {
responses.add(dataKey, response);
}
// first call noOp, other if checks below depends on it.
if (noOp(entry, oldValue, now)) {
continue;
}
if (entryRemoved(entry, dataKey, oldValue, now)) {
continue;
}
entryAddedOrUpdated(entry, dataKey, oldValue, now);
evict(dataKey);
}
}
use of com.hazelcast.map.impl.MapEntries in project hazelcast by hazelcast.
the class MapProxySupport method getAllObjectInternal.
protected void getAllObjectInternal(List<Data> keys, List<Object> resultingKeyValuePairs) {
if (keys == null || keys.isEmpty()) {
return;
}
if (keys.isEmpty()) {
return;
}
Collection<Integer> partitions = getPartitionsForKeys(keys);
Map<Integer, Object> responses;
try {
OperationFactory operationFactory = operationProvider.createGetAllOperationFactory(name, keys);
long time = System.currentTimeMillis();
responses = operationService.invokeOnPartitions(SERVICE_NAME, operationFactory, partitions);
for (Object response : responses.values()) {
MapEntries entries = toObject(response);
for (int i = 0; i < entries.size(); i++) {
resultingKeyValuePairs.add(toObject(entries.getKey(i)));
resultingKeyValuePairs.add(toObject(entries.getValue(i)));
}
}
localMapStats.incrementGets(keys.size(), System.currentTimeMillis() - time);
} catch (Exception e) {
throw rethrow(e);
}
}
use of com.hazelcast.map.impl.MapEntries in project hazelcast by hazelcast.
the class PutAllBackupOperation method readInternal.
@Override
protected void readInternal(ObjectDataInput in) throws IOException {
super.readInternal(in);
entries = new MapEntries();
entries.readData(in);
int size = entries.size();
recordInfos = new ArrayList<RecordInfo>(size);
for (int i = 0; i < size; i++) {
RecordInfo recordInfo = new RecordInfo();
recordInfo.readData(in);
recordInfos.add(recordInfo);
}
}
use of com.hazelcast.map.impl.MapEntries in project hazelcast by hazelcast.
the class PutAllOperation method readInternal.
@Override
protected void readInternal(ObjectDataInput in) throws IOException {
super.readInternal(in);
mapEntries = new MapEntries();
mapEntries.readData(in);
}
use of com.hazelcast.map.impl.MapEntries in project hazelcast by hazelcast.
the class PutAllPartitionAwareOperationFactory method writeData.
@Override
public void writeData(ObjectDataOutput out) throws IOException {
out.writeUTF(name);
out.writeIntArray(partitions);
for (MapEntries entry : mapEntries) {
entry.writeData(out);
}
}
Aggregations