/** {@inheritDoc} */ @Override public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException { GridBiTuple<GridCacheContext, String> t = stash.get(); t.set1((GridCacheContext) in.readObject()); t.set2(in.readUTF()); }
/** {@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()); } }
/** * Reconstructs object on demarshalling. * * @return Reconstructed object. * @throws ObjectStreamException Thrown in case of demarshalling error. */ @SuppressWarnings("unchecked") private Object readResolve() throws ObjectStreamException { try { GridBiTuple<GridCacheContext, String> t = stash.get(); return t.get1().dataStructures().atomicReference(t.get2(), null, false); } catch (GridException e) { throw U.withCause(new InvalidObjectException(e.getMessage()), e); } finally { stash.remove(); } }
/** {@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; }