.get(0).getRow(), operationTimeout) {
public List<Boolean> call() throws IOException {
try {
MultiGetRequest requests = RequestConverter.buildMultiGetRequest(location
.getRegionInfo().getRegionName(), getsByRegionEntry.getValue(), true, false);
MultiGetResponse responses = server.multiGet(null, requests);
return responses.getExistsList();
} catch (ServiceException se) {
throw ProtobufUtil.getRemoteException(se);
}
}
}.withRetries();
}
};
futures.put(getsByRegionEntry.getKey(), pool.submit(callable));
}
// step 3: collect the failures and successes
Map<Integer, List<Boolean>> responses = new HashMap<Integer, List<Boolean>>();
for (final Map.Entry<Integer, List<Get>> sortedGetEntry : getsByRegion.entrySet()) {
try {
Future<List<Boolean>> future = futures.get(sortedGetEntry.getKey());
List<Boolean> resp = future.get();
if (resp == null) {
LOG.warn("Failed for gets on region: " + sortedGetEntry.getKey());
}
responses.put(sortedGetEntry.getKey(), resp);
} catch (ExecutionException e) {
LOG.warn("Failed for gets on region: " + sortedGetEntry.getKey());
} catch (InterruptedException e) {
LOG.warn("Failed for gets on region: " + sortedGetEntry.getKey());
Thread.currentThread().interrupt();
}
}
Boolean[] results = new Boolean[sortedGetsList.size()];
// step 4: build the response.
Map<Integer, Integer> indexes = new HashMap<Integer, Integer>();
for (int i = 0; i < sortedGetsList.size(); i++) {
Integer regionInfoIndex = getToRegionIndexMap.get(sortedGetsList.get(i).getGet());
Integer index = indexes.get(regionInfoIndex);
if (index == null) {
index = 0;
}
results[sortedGetsList.get(i).getInitialIndex()] = responses.get(regionInfoIndex).get(index);
indexes.put(regionInfoIndex, index + 1);
}
return results;
}