Search in sources :

Example 1 with VisorClusterGroupEmptyException

use of org.apache.ignite.internal.visor.util.VisorClusterGroupEmptyException in project ignite by apache.

the class VisorQueryCleanupTask method map0.

/**
 * {@inheritDoc}
 */
@Override
protected Map<? extends ComputeJob, ClusterNode> map0(List<ClusterNode> subgrid, @Nullable VisorTaskArgument<VisorQueryCleanupTaskArg> arg) {
    Set<UUID> nodeIds = taskArg.getQueryIds().keySet();
    if (nodeIds.isEmpty())
        throw new VisorClusterGroupEmptyException("Nothing to clear. List with node IDs is empty!");
    Map<ComputeJob, ClusterNode> map = U.newHashMap(nodeIds.size());
    try {
        for (ClusterNode node : subgrid) if (nodeIds.contains(node.id()))
            map.put(new VisorQueryCleanupJob(taskArg.getQueryIds().get(node.id()), debug), node);
        if (map.isEmpty()) {
            StringBuilder notFoundNodes = new StringBuilder();
            for (UUID nid : nodeIds) notFoundNodes.append((notFoundNodes.length() == 0) ? "" : ",").append(U.id8(nid));
            throw new VisorClusterGroupEmptyException("Failed to clear query results. Nodes are not available: [" + notFoundNodes + "]");
        }
        return map;
    } finally {
        if (debug)
            logMapped(ignite.log(), getClass(), map.values());
    }
}
Also used : ClusterNode(org.apache.ignite.cluster.ClusterNode) ComputeJob(org.apache.ignite.compute.ComputeJob) VisorClusterGroupEmptyException(org.apache.ignite.internal.visor.util.VisorClusterGroupEmptyException) UUID(java.util.UUID)

Aggregations

UUID (java.util.UUID)1 ClusterNode (org.apache.ignite.cluster.ClusterNode)1 ComputeJob (org.apache.ignite.compute.ComputeJob)1 VisorClusterGroupEmptyException (org.apache.ignite.internal.visor.util.VisorClusterGroupEmptyException)1