/** @param jobId Job id. */ public void jobFinished(GridHadoopJobId jobId) { GridHadoopShuffleJob job = jobs.remove(jobId); if (job != null) { try { job.close(); } catch (GridException e) { U.error(log, "Failed to close job: " + jobId, e); } } }
/** * Stops shuffle. * * @param cancel If should cancel all ongoing activities. */ @Override public void stop(boolean cancel) { for (GridHadoopShuffleJob job : jobs.values()) { try { job.close(); } catch (GridException e) { U.error(log, "Failed to close job.", e); } } jobs.clear(); }
/** * @param jobId Task info. * @return Shuffle job. */ private GridHadoopShuffleJob<UUID> job(GridHadoopJobId jobId) throws GridException { GridHadoopShuffleJob<UUID> res = jobs.get(jobId); if (res == null) { res = newJob(jobId); GridHadoopShuffleJob<UUID> old = jobs.putIfAbsent(jobId, res); if (old != null) { res.close(); res = old; } else if (res.reducersInitialized()) startSending(res); } return res; }