Source:
<code>public void storeWorkerMetrics(final String workerId, final WorkerMetrics metrics) { if (metricCollectionEnabled) { if (numBlockByEvalIdForWorker != null && numBlockByEvalIdForWorker.containsKey(workerId)) { final int numDataBlocks = numBlockByEvalIdForWorker.get(workerId); final DataInfo dataInfo = new DataInfoImpl(numDataBlocks); final EvaluatorParameters evaluatorParameters = new WorkerEvaluatorParameters(workerId, dataInfo, metrics); if (metrics.getMiniBatchIdx() == null) { synchronized (workerEvalEpochParams) { if (!workerEvalEpochParams.containsKey(workerId)) { workerEvalEpochParams.put(workerId, new ArrayList<>()); } else { <START> workerEvalEpochParams.get(workerId).add(evaluatorParameters); <END> } } } else { synchronized (workerEvalMiniBatchParams) { if (!workerEvalMiniBatchParams.containsKey(workerId)) { workerEvalMiniBatchParams.put(workerId, new ArrayList<>()); } else { workerEvalMiniBatchParams.get(workerId).add(evaluatorParameters); } } } } else { LOG.log(Level.FINE, "No information about {0}. Dropping metric.", workerId); } } else { LOG.log(Level.FINE, "Metric collection disabled. Dropping metric from {0}", workerId); } if (dashboardSetupStatus.dashboardEnabled) { try { metricsRequestQueue.put(String.format("id=%s&metrics=%s&time=%d", workerId, metrics, System.currentTimeMillis())); } catch (InterruptedException e) { LOG.log(Level.WARNING, "Dashboard: Interrupted while taking metrics to send from the queue.", e); } } }</code><technical_language>synchronized block accessing *Params map. simple HashMap instead of Collections.synchronizedMap</technical_language>

Target:
public void storeWorkerMetrics(final String workerId, final WorkerMetrics metrics) { if (metricCollectionEnabled) { if (numBlockByEvalIdForWorker != null && numBlockByEvalIdForWorker.containsKey(workerId)) { final int numDataBlocks = numBlockByEvalIdForWorker.get(workerId); final DataInfo dataInfo = new DataInfoImpl(numDataBlocks); final EvaluatorParameters evaluatorParameters = new WorkerEvaluatorParameters(workerId, dataInfo, metrics); if (metrics.getMiniBatchIdx() == null) { synchronized (workerEvalEpochParams) { if (!workerEvalEpochParams.containsKey(workerId)) { workerEvalEpochParams.put(workerId, new ArrayList<>()); } else { if (metrics.getNumDataBlocks() == numDataBlocks) { workerEvalEpochParams.get(workerId).add(evaluatorParameters); } else { LOG.log(Level.SEVERE, "Inconsistent NumDataBlocks: driver = {0}, {1} = {2}", new Object[] {numDataBlocks, workerId, metrics.getNumDataBlocks()}); } } } } else { synchronized (workerEvalMiniBatchParams) { if (workerEvalEpochParams.containsKey(workerId)) { if (!workerEvalMiniBatchParams.containsKey(workerId)) { workerEvalMiniBatchParams.put(workerId, new ArrayList<>()); } workerEvalMiniBatchParams.get(workerId).add(evaluatorParameters); } } } } else { LOG.log(Level.FINE, "No information about {0}. Dropping metric.", workerId); } } else { LOG.log(Level.FINE, "Metric collection disabled. Dropping metric from {0}", workerId); } if (dashboardSetupStatus.dashboardEnabled) { try { metricsRequestQueue.put(String.format("id=%s&metrics=%s&time=%d", workerId, metrics, System.currentTimeMillis())); } catch (InterruptedException e) { LOG.log(Level.WARNING, "Dashboard: Interrupted while taking metrics to send from the queue.", e); } } }