@Override
public <T, K> List<Future<T>> submitEverywhere(DistributedTask<T> task, K... input) {
if (task == null) throw new NullPointerException();
if(inputKeysSpecified(input)) {
List<Future<T>> futures = new ArrayList<Future<T>>(input.length * 2);
Address me = getAddress();
Map<Address, List<K>> nodesKeysMap = keysToExecutionNodes(task.getTaskExecutionPolicy(), input);
checkExecutionPolicy(task, nodesKeysMap, input);
for (Entry<Address, List<K>> e : nodesKeysMap.entrySet()) {
Address target = e.getKey();
DistributedExecuteCommand<T> c = null;
if (target.equals(me)) {
c = factory.buildDistributedExecuteCommand(clone(task.getCallable()), me, e.getValue());
} else {
c = factory.buildDistributedExecuteCommand(task.getCallable(), me, e.getValue());
}
DistributedTaskPart<T> part = createDistributedTaskPart(task, c, e.getValue(), target, 0);