final List<GridNode> replicatedNodes = collector.getMatched();
if(replicatedNodes == null || replicatedNodes.isEmpty()) {
throw new GridException("No replicated document found for path: " + path);
}
// TODO Select a node that least recently used for write requests.
GridNode node = nodeSelector.selectNode(replicatedNodes, config);
assert (node != null);
List<String> mappedPaths = assignMap.get(node);
if(mappedPaths == null) {
mappedPaths = new ArrayList<String>(16);
assignMap.put(node, mappedPaths);
}
mappedPaths.add(path);
}
}
final Map<GridTask, GridNode> map = new IdentityHashMap<GridTask, GridNode>(assignMap.size() + 1);
for(Map.Entry<GridNode, List<String>> e : assignMap.entrySet()) {
GridNode node = e.getKey();
List<String> mappedPaths = e.getValue();
DispatchQueryExecTask dispatchTask = new DispatchQueryExecTask(execJob, _bindingVar, _bodyExpr, _exprBytes, mappedPaths, true);
map.put(dispatchTask, node);
}
if(!localExecResources.isEmpty()) {