Iterable<Map.Entry<String, Writable>> myReducedValues =
ownerGlobalCommData.getMyReducedValuesWhenReady(
getOtherWorkerIdsSet());
// Send final aggregated values to master
GlobalCommValueOutputStream globalOutput =
new GlobalCommValueOutputStream(false);
for (Map.Entry<String, Writable> entry : myReducedValues) {
try {
int currentSize = globalOutput.addValue(entry.getKey(),
GlobalCommType.REDUCED_VALUE,
entry.getValue());
if (currentSize > maxBytesPerAggregatorRequest) {
requestProcessor.sendReducedValuesToMaster(
globalOutput.flush());
}
progressable.progress();
} catch (IOException e) {
throw new IllegalStateException("finishSuperstep: " +
"IOException occurred while writing aggregator " +
entry.getKey(), e);
}
}
try {
requestProcessor.sendReducedValuesToMaster(globalOutput.flush());
} catch (IOException e) {
throw new IllegalStateException("finishSuperstep: " +
"IOException occured while sending aggregators to master", e);
}
// Wait for master to receive aggregated values before proceeding