@Override public Map<K, V> getAll(Set<? extends K> keys, ExpiryPolicy expiryPolicy) { ensureOpen(); validateNotNull(keys); if (keys.isEmpty()) { return Collections.EMPTY_MAP; } final Set<Data> keySet = new HashSet(keys.size()); for (K key : keys) { final Data k = toData(key); keySet.add(k); } Map<K, V> result = getAllFromNearCache(keySet); if (keySet.isEmpty()) { return result; } Data expiryPolicyData = toData(expiryPolicy); ClientMessage request = CacheGetAllCodec.encodeRequest(nameWithPrefix, keySet, expiryPolicyData); ClientMessage responseMessage = invoke(request); Set<Map.Entry<Data, Data>> entrySet = CacheGetAllCodec.decodeResponse(responseMessage).entrySet; for (Map.Entry<Data, Data> dataEntry : entrySet) { Data keyData = dataEntry.getKey(); Data valueData = dataEntry.getValue(); K key = toObject(keyData); V value = toObject(valueData); result.put(key, value); storeInNearCache(keyData, valueData, value); } return result; }
@Override protected ClientMessage encodeResponse(Object response) { return CacheGetAllCodec.encodeResponse((Set<Map.Entry<Data, Data>>) response); }
@Override protected CacheGetAllCodec.RequestParameters decodeClientMessage(ClientMessage clientMessage) { return CacheGetAllCodec.decodeRequest(clientMessage); }