/** {@inheritDoc} */ @Override public void run() { for (I rec : buf) { GridBiTuple<K, V> entry = parse(rec, args); if (entry != null) c.apply(entry.getKey(), entry.getValue()); } }
/** {@inheritDoc} */ @Override public String reduce(List<GridComputeJobResult> results) throws GridException { int sum = 0; String locNodeId = null; for (GridComputeJobResult res : results) { GridBiTuple<String, Integer> part = res.getData(); if (locNodeId == null) locNodeId = part.get1(); Integer i = part.get2(); if (i != null) sum += i; } assert gridSize == sum; return locNodeId; }