}
}
protected Set<KOut> executeMapPhase() throws InterruptedException,
ExecutionException {
RpcManager rpc = cache.getRpcManager();
MapCombineCommand<KIn, VIn, KOut, VOut> cmd = null;
Set<KOut> mapPhasesResult = new HashSet<KOut>();
List<MapTaskPart<Set<KOut>>> futures = new ArrayList<MapTaskPart<Set<KOut>>>();
if (inputTaskKeysEmpty()) {
for (Address target : rpc.getMembers()) {
if (target.equals(rpc.getAddress())) {
cmd = buildMapCombineCommand(taskId.toString(), clone(mapper), clone(combiner),
getIntermediateCacheName(), null, true, useIntermediateSharedCache());
} else {
cmd = buildMapCombineCommand(taskId.toString(), mapper, combiner, getIntermediateCacheName(), null,
true, useIntermediateSharedCache());
}
MapTaskPart<Set<KOut>> part = createTaskMapPart(cmd, target, true);
part.execute();
futures.add(part);
}
} else {
Map<Address, ? extends Collection<KIn>> keysToNodes = mapKeysToNodes(keys);
for (Entry<Address, ? extends Collection<KIn>> e : keysToNodes.entrySet()) {
Address address = e.getKey();
Collection<KIn> keys = e.getValue();
if (address.equals(rpc.getAddress())) {
cmd = buildMapCombineCommand(taskId.toString(), clone(mapper), clone(combiner),
getIntermediateCacheName(), keys, true, useIntermediateSharedCache());
} else {
cmd = buildMapCombineCommand(taskId.toString(), mapper, combiner, getIntermediateCacheName(), keys,
true, useIntermediateSharedCache());