use of com.hazelcast.map.impl.MapEntries in project hazelcast by hazelcast.
the class AbstractCacheProxy method getAll.
@Override
public Map<K, V> getAll(Set<? extends K> keys, ExpiryPolicy expiryPolicy) {
ensureOpen();
validateNotNull(keys);
if (keys.isEmpty()) {
return Collections.EMPTY_MAP;
}
Set<Data> ks = new HashSet<Data>(keys.size());
for (K key : keys) {
Data dataKey = serializationService.toData(key);
ks.add(dataKey);
}
Map<K, V> result = new HashMap<K, V>();
Collection<Integer> partitions = getPartitionsForKeys(ks);
try {
OperationFactory factory = operationProvider.createGetAllOperationFactory(ks, expiryPolicy);
OperationService operationService = getNodeEngine().getOperationService();
Map<Integer, Object> responses = operationService.invokeOnPartitions(getServiceName(), factory, partitions);
for (Object response : responses.values()) {
MapEntries mapEntries = serializationService.toObject(response);
mapEntries.putAllToMap(serializationService, result);
}
} catch (Throwable e) {
throw rethrowAllowedTypeFirst(e, CacheException.class);
}
return result;
}
use of com.hazelcast.map.impl.MapEntries in project hazelcast by hazelcast.
the class AbstractCacheRecordStore method getAll.
@Override
public MapEntries getAll(Set<Data> keySet, ExpiryPolicy expiryPolicy) {
expiryPolicy = getExpiryPolicy(expiryPolicy);
MapEntries result = new MapEntries(keySet.size());
for (Data key : keySet) {
Object value = get(key, expiryPolicy);
if (value != null) {
result.add(key, toHeapData(value));
}
}
return result;
}
use of com.hazelcast.map.impl.MapEntries in project hazelcast by hazelcast.
the class CacheGetAllMessageTask method reduce.
@Override
protected Object reduce(Map<Integer, Object> map) {
List<Map.Entry<Data, Data>> reducedMap = new ArrayList<Map.Entry<Data, Data>>(map.size());
for (Map.Entry<Integer, Object> entry : map.entrySet()) {
MapEntries mapEntries = (MapEntries) nodeEngine.toObject(entry.getValue());
mapEntries.putAllToList(reducedMap);
}
return reducedMap;
}
use of com.hazelcast.map.impl.MapEntries in project hazelcast by hazelcast.
the class MapExecuteWithPredicateMessageTask method reduce.
@Override
protected Object reduce(Map<Integer, Object> map) {
List<Map.Entry<Data, Data>> dataMap = new ArrayList<Map.Entry<Data, Data>>();
MapService mapService = getService(MapService.SERVICE_NAME);
for (Object o : map.values()) {
if (o != null) {
MapEntries mapEntries = (MapEntries) mapService.getMapServiceContext().toObject(o);
mapEntries.putAllToList(dataMap);
}
}
return dataMap;
}
use of com.hazelcast.map.impl.MapEntries in project hazelcast by hazelcast.
the class MapPutAllMessageTask method prepareOperation.
@Override
protected Operation prepareOperation() {
MapEntries mapEntries = new MapEntries(parameters.entries);
MapOperationProvider operationProvider = getMapOperationProvider(parameters.name);
return operationProvider.createPutAllOperation(parameters.name, mapEntries);
}
Aggregations