@Override public Service distribute(final ExecutorService executor, final String sessionId, final String taskId, final Multimap<NodeType, NodeId> availableNodes, final Coordinator coordinator, final T task, final DistributionListener listener, NodeContext nodeContext) { Set<Qualifier<?>> qualifiers = getQualifiers(); final Map<NodeId, RemoteExecutor> remotes = Maps.newHashMap(); for (NodeId nodeId : availableNodes.get(NodeType.KERNEL)) { boolean canRunTheCommand = coordinator.canExecuteCommands(nodeId, qualifiers); if (canRunTheCommand) { remotes.put(nodeId, coordinator.getExecutor(nodeId)); } else { log.debug("command type {} are not supported by kernel {}", qualifiers, nodeId); } } if (remotes.isEmpty()) { throw new NodeNotFound("Nodes not found to distribute the task"); } final Service service = performDistribution(executor, sessionId, taskId, task, remotes, availableNodes, coordinator, nodeContext); return new ListenableService<T>(service, executor, sessionId, taskId, task, listener, remotes); }