Ejemplo n.º 1
0
  /** {@inheritDoc} */
  @Override
  public Integer reduce(List<ComputeJobResult> results) {
    int sum = 0;

    for (ComputeJobResult res : results) sum += res.<Integer>getData();

    return sum;
  }
  /** {@inheritDoc} */
  @Nullable
  @Override
  protected Map<UUID, IgniteBiTuple<Long, List<IgniteExceptionRegistry.ExceptionInfo>>> reduce0(
      List<ComputeJobResult> results) {
    Map<UUID, IgniteBiTuple<Long, List<IgniteExceptionRegistry.ExceptionInfo>>> taskRes =
        new HashMap<>(results.size());

    for (ComputeJobResult res : results) {
      IgniteBiTuple<Long, List<IgniteExceptionRegistry.ExceptionInfo>> jobRes = res.getData();

      taskRes.put(res.getNode().id(), jobRes);
    }

    return taskRes;
  }
    /** {@inheritDoc} */
    @Override
    public Object reduce(List<ComputeJobResult> results) {
      if (log.isInfoEnabled())
        log.info("Aggregating job [job=" + this + ", results=" + results + ']');

      int res = 0;

      for (ComputeJobResult result : results) {
        assert result != null;

        if (result.getData() != null) res += (Integer) result.getData();
      }

      return res;
    }
Ejemplo n.º 4
0
  /** {@inheritDoc} */
  @Override
  public ComputeJobResultPolicy result(ComputeJobResult res, List<ComputeJobResult> rcvd) {
    if (res.getException() != null) return FAILOVER;

    return WAIT;
  }