Performs the output aggregation and generates the {@link WorkerToMasterReports} to report back to the
{@link org.apache.reef.vortex.driver.VortexDriver}.
429555
private void aggregateTasklets(final AggregateTriggerType type) {
    final List<WorkerToMasterReport> workerToMasterReports = new ArrayList<>();
    final List<Object> results = new ArrayList<>();
    final List<Integer> aggregatedTasklets = new ArrayList<>();

    // Synchronization to prevent duplication of work on the same aggregation function on the same worker.
    synchronized (stateLock) {
      switch(type) {
      case ALARM:
        aggregateTasklets(workerToMasterReports, results, aggregatedTasklets);
        break;
      case COUNT:
        if (!aggregateOnCount()) {
          return;
        }

        aggregateTasklets(workerToMasterReports, results, aggregatedTasklets);
        break;
      default:
        throw new RuntimeException("Unexpected aggregate type.");
      }
    }

    if (!results.isEmpty()) {
      // Run the aggregation function.
      try {
        final Object aggregationResult = taskletAggregationRequest.executeAggregation(results);
        workerToMasterReports.add(new TaskletAggregationResultReport(aggregatedTasklets, aggregationResult));
      } catch (final Exception e) {
        workerToMasterReports.add(new TaskletAggregationFailureReport(aggregatedTasklets, e));
      }
    }

    // Add to worker report only if there is something to report back.
    if (!workerToMasterReports.isEmpty()) {
      workerReportsQueue.addLast(kryoUtils.serialize(new WorkerToMasterReports(workerToMasterReports)));
      heartBeatTriggerManager.triggerHeartBeat();
    }
  }
1189197
@Override
  public BlockIntegrityMonitor.Status getAggregateStatus() {
    Status fixer = corruptionWorker.getStatus();
    Status copier = decommissioningWorker.getStatus();

    List<JobStatus> jobs = new ArrayList<JobStatus>();
    List<JobStatus> simFailedJobs = new ArrayList<JobStatus>();
    List<JobStatus> failedJobs = new ArrayList<JobStatus>();
    List<String> highPriFileNames = new ArrayList<String>();
    int numHighPriFiles = 0;
    int numLowPriFiles = 0;
    int numLowestPriFiles = 0;
    if (fixer != null) {
      jobs.addAll(fixer.jobs);
      simFailedJobs.addAll(fixer.simFailJobs);
      failedJobs.addAll(fixer.failJobs);
      if (fixer.highPriorityFileNames != null) {
        highPriFileNames.addAll(fixer.highPriorityFileNames);
      }
      numHighPriFiles += fixer.highPriorityFiles;
      numLowPriFiles += fixer.lowPriorityFiles;
      numLowestPriFiles += fixer.lowestPriorityFiles;
    }
    if (copier != null) {
      jobs.addAll(copier.jobs);
      simFailedJobs.addAll(copier.simFailJobs);
      failedJobs.addAll(copier.failJobs);
      if (copier.highPriorityFileNames != null) {
        highPriFileNames.addAll(copier.highPriorityFileNames);
      }
      numHighPriFiles += copier.highPriorityFiles;
      numLowPriFiles += copier.lowPriorityFiles;
      numLowestPriFiles += copier.lowestPriorityFiles;
    }

    return new Status(numHighPriFiles, numLowPriFiles, numLowestPriFiles,
                      jobs, highPriFileNames,failedJobs, simFailedJobs);
  }
1017617
public static ReportBuilder newReportBuilder(SpoonMojoGenerate spoon) {
		final long timestamp = Calendar.getInstance().getTimeInMillis();
		final String resultFilename = spoon.getProject().getBuild().getDirectory()
				+ File.separator + "spoon-maven-plugin"
				+ File.separator + "result-spoon-" + timestamp + ".xml";
		final File resultFile = new File(resultFilename);
		LogWrapper.info(spoon, String.format("Spoon report directory: %s", resultFile.getParentFile().getAbsolutePath()));
		return new ReportBuilderImpl(resultFile);
	}
540397
public function renderReports(OutputInterface $output, SuiteCollection $collection, array $reportNames, array $outputNames)
    {
        $reportDoms = $this->generateReports($collection, $reportNames);

        foreach ($outputNames as $outputName) {
            $outputConfig = $this->rendererRegistry->getConfig($outputName);
            $renderer = $this->rendererRegistry->getService($outputConfig['renderer']);
            assert($renderer instanceof RendererInterface);

            // set the output instance if the renderer requires it.
            if ($renderer instanceof OutputAwareInterface) {
                $renderer->setOutput($output);
            }

            foreach ($reportDoms as $reportDom) {
                $renderer->render($reportDom->duplicate(), $outputConfig);
            }
        }
    }
306447
@Override
	public void report() {
		// instead of locking here, we tolerate exceptions
		// we do this to prevent holding the lock for very long and blocking
		// operator creation and shutdown
		try {
			for (Map.Entry<Gauge<?>, String> entry : gauges.entrySet()) {
				if (closed) {
					return;
				}
				reportGauge(entry.getValue(), entry.getKey());
			}

			for (Map.Entry<Counter, String> entry : counters.entrySet()) {
				if (closed) {
					return;
				}
				reportCounter(entry.getValue(), entry.getKey());
			}

			for (Map.Entry<Histogram, String> entry : histograms.entrySet()) {
				reportHistogram(entry.getValue(), entry.getKey());
			}

			for (Map.Entry<Meter, String> entry : meters.entrySet()) {
				reportMeter(entry.getValue(), entry.getKey());
			}
		}
		catch (ConcurrentModificationException | NoSuchElementException e) {
			// ignore - may happen when metrics are concurrently added or removed
			// report next time
		}
	}
972518
@Override
    protected void writeToOutput(final Map<String, Object> row)
            throws IOException {
        if (generator == null) {
            ObjectMapper mapper = new ObjectMapper();
            BsonFactory factory = new BsonFactory(mapper);
            factory.enable(BsonGenerator.Feature.ENABLE_STREAMING);
            generator = factory.createJsonGenerator(getOutputStream());
            generator.writeStartArray(); // [
        }

        // Convert the tuple into a map
        generator.writeObject(row);
    }
1341982
def report(self, simulation, state):
        
        if not self._initialized:
            self._initial_clock_time = datetime.now()
            self._initial_simulation_time = state.getTime()
            self._initial_steps = simulation.currentStep
            self._initialized = True

        steps = simulation.currentStep
        time = datetime.now() - self._initial_clock_time
        days = time.total_seconds()/86400.0
        ns = (state.getTime()-self._initial_simulation_time).value_in_unit(u.nanosecond)

        margin = ' ' * self.margin
        ns_day = ns/days
        delta = ((self.total_steps-steps)*time.total_seconds())/steps
        # remove microseconds to have cleaner output
        remaining = timedelta(seconds=int(delta))
        percentage = 100.0*steps/self.total_steps
        if ns_day:
            template = '{}{}/{} steps ({:.1f}%) - {} left @ {:.1f} ns/day                    \r'
        else:
            template = '{}{}/{} steps ({:.1f}%)                                              \r'
        report = template.format(margin, steps, self.total_steps, percentage, remaining, ns_day)
        self._out.write(report)
        if hasattr(self._out, 'flush'):
            self._out.flush()
312774
def _generate_report(ret, show_tasks):
    '''
    
    '''

    returns = ret.get('return')

    sorted_data = sorted(
        returns.items(),
        key=lambda s: s[1].get('__run_num__', 0)
    )

    total = 0
    failed = 0
    changed = 0
    duration = 0.0

    changed_tasks = []
    failed_tasks = []

    # gather stats
    for state, data in sorted_data:
        # state: module, stateid, name, function
        _, stateid, _, _ = state.split('_|-')
        task = '{filename}.sls | {taskname}'.format(
            filename=str(data.get('__sls__')), taskname=stateid)

        if not data.get('result', True):
            failed += 1
            failed_tasks.append(task)

        if data.get('changes', {}):
            changed += 1
            changed_tasks.append(task)

        total += 1
        try:
            duration += float(data.get('duration', 0.0))
        except ValueError:
            pass

    unchanged = total - failed - changed

    log.debug('%s total: %s', __virtualname__, total)
    log.debug('%s failed: %s', __virtualname__, failed)
    log.debug('%s unchanged: %s', __virtualname__, unchanged)
    log.debug('%s changed: %s', __virtualname__, changed)

    report = {
        'id': ret.get('id'),
        'success': True if failed == 0 else False,
        'total': total,
        'function': ret.get('fun'),
        'arguments': ret.get('fun_args', []),
        'jid': ret.get('jid'),
        'duration': duration / 1000,
        'unchanged': {
            'counter': unchanged
        },
        'changed': {
            'counter': changed,
            'tasks': changed_tasks if show_tasks else []
        },
        'failed': {
            'counter': failed,
            'tasks': failed_tasks if show_tasks else []
        }
    }

    return report
19590
public void generateReport (String arg1, InvocationService.ResultListener arg2)
    {
        InvocationMarshaller.ResultMarshaller listener2 = new InvocationMarshaller.ResultMarshaller();
        listener2.listener = arg2;
        sendRequest(GENERATE_REPORT, new Object[] {
            arg1, listener2
        });
    }
465180
@Override
    public JobReport mergerReports(JobReport... jobReports) {

        List<Long> startTimes = new ArrayList<>();
        List<Long> endTimes = new ArrayList<>();
        List<String> jobNames = new ArrayList<>();

        JobParameters parameters = new JobParameters();
        JobMetrics metrics = new JobMetrics();
        JobReport finalJobReport = new JobReport();
        finalJobReport.setParameters(parameters);
        finalJobReport.setMetrics(metrics);
        finalJobReport.setStatus(JobStatus.COMPLETED);

        for (JobReport jobReport : jobReports) {
            startTimes.add(jobReport.getMetrics().getStartTime());
            endTimes.add(jobReport.getMetrics().getEndTime());
            calculateReadRecords(finalJobReport, jobReport);
            calculateWrittenRecords(finalJobReport, jobReport);
            calculateFilteredRecords(finalJobReport, jobReport);
            calculateErrorRecords(finalJobReport, jobReport);
            setStatus(finalJobReport, jobReport);
            jobNames.add(jobReport.getJobName());
            finalJobReport.setSystemProperties(jobReport.getSystemProperties()); // works unless partial jobs are run in different JVMs..
        }

        //merge results
        finalJobReport.getMetrics().setStartTime(Collections.min(startTimes));
        finalJobReport.getMetrics().setEndTime(Collections.max(endTimes));

        // set name
        finalJobReport.setJobName(concatenate(jobNames));

        return finalJobReport;
    }
200721
@Override
    protected GeneratedData genVdmToTargetLang(List<IRStatus<PIR>> statuses) throws AnalysisException {
        GeneratedData r = new GeneratedData();
        try {
            // Apply transformations
            for (IRStatus<PIR> status : statuses) {
                // make init expression an op
                StateInit stateInit = new StateInit(getInfo());
                generator.applyPartialTransformation(status, stateInit);

                // transform away any recursion cycles
                GroupMutRecs groupMR = new GroupMutRecs();
                generator.applyTotalTransformation(status, groupMR);

                if (status.getIrNode() instanceof AModuleDeclIR) {
                    AModuleDeclIR cClass = (AModuleDeclIR) status.getIrNode();
                    // then sort remaining dependencies
                    SortDependencies sortTrans = new SortDependencies(cClass.getDecls());
                    generator.applyPartialTransformation(status, sortTrans);
                }
            }

            r.setClasses(prettyPrint(statuses));
        } catch (org.overture.codegen.ir.analysis.AnalysisException e) {
            throw new AnalysisException(e);
        }
        return r;

    }
649257
public void generate(List<File> reportInputDataDirs, File reportOutputDir)
            throws IllegalDataStructureException, IllegalTestScriptException {
        deleteDirIfExists(reportOutputDir); // delete previous execution output
        File htmlExternalResRootDir = CommonPath.htmlExternalResourceRootDir(reportOutputDir);
        SrcTree srcTree = generateSrcTree(reportInputDataDirs);
        List<RunResults> runResultsList = generateRunResultList(reportInputDataDirs, srcTree);

        // generate src-tree-yaml.js
        VelocityContext srcTreeContext = new VelocityContext();
        // don't need HTML encode
        String srcTreeYamlStr = YamlUtils.dumpToString(srcTree.toYamlObject());
        srcTreeContext.put("yamlStr", srcTreeYamlStr);
        File srcTreeYamlJsFile = new File(htmlExternalResRootDir, "js/report/src-tree-yaml.js");
        generateVelocityOutput(srcTreeContext, "/template/src-tree-yaml.js.vm", srcTreeYamlJsFile);

        // set up HTML external files
        // TODO all file paths are hard coded. this is very poor logic..
        extractHtmlExternalResFromThisJar(htmlExternalResRootDir, "js/share/common-utils.js");
        extractHtmlExternalResFromThisJar(htmlExternalResRootDir, "js/share/capture-style.js");
        extractHtmlExternalResFromThisJar(htmlExternalResRootDir, "js/share/yaml/js-yaml.min.js");
        extractHtmlExternalResFromThisJar(htmlExternalResRootDir, "js/share/yaml/yaml-utils.js");
        extractHtmlExternalResFromThisJar(htmlExternalResRootDir, "js/share/srctree/code/code.js");
        extractHtmlExternalResFromThisJar(htmlExternalResRootDir, "js/share/srctree/code/string-code.js");
        extractHtmlExternalResFromThisJar(htmlExternalResRootDir, "js/share/srctree/code/method-argument.js");
        extractHtmlExternalResFromThisJar(htmlExternalResRootDir, "js/share/srctree/code/unknown-code.js");
        extractHtmlExternalResFromThisJar(htmlExternalResRootDir, "js/share/srctree/code/sub-method-invoke.js");
        extractHtmlExternalResFromThisJar(htmlExternalResRootDir, "js/share/srctree/code/local-var.js");
        extractHtmlExternalResFromThisJar(htmlExternalResRootDir, "js/share/srctree/code/field.js");
        extractHtmlExternalResFromThisJar(htmlExternalResRootDir, "js/share/srctree/code/var-assign.js");
        extractHtmlExternalResFromThisJar(htmlExternalResRootDir, "js/share/srctree/code/class-instance.js");
        extractHtmlExternalResFromThisJar(htmlExternalResRootDir, "js/share/srctree/code/test-step.js");
        extractHtmlExternalResFromThisJar(htmlExternalResRootDir, "js/share/srctree/code/test-step-label.js");
        extractHtmlExternalResFromThisJar(htmlExternalResRootDir, "js/share/srctree/code/code-line.js");
        extractHtmlExternalResFromThisJar(htmlExternalResRootDir, "js/share/srctree/test-class.js");
        extractHtmlExternalResFromThisJar(htmlExternalResRootDir, "js/share/srctree/page-class.js");
        extractHtmlExternalResFromThisJar(htmlExternalResRootDir, "js/share/srctree/test-field.js");
        extractHtmlExternalResFromThisJar(htmlExternalResRootDir, "js/share/srctree/test-field-table.js");
        extractHtmlExternalResFromThisJar(htmlExternalResRootDir, "js/share/srctree/test-method.js");
        extractHtmlExternalResFromThisJar(htmlExternalResRootDir, "js/share/srctree/test-method-table.js");
        extractHtmlExternalResFromThisJar(htmlExternalResRootDir, "js/share/srctree/test-class-table.js");
        extractHtmlExternalResFromThisJar(htmlExternalResRootDir, "js/share/srctree/src-tree.js");
        extractHtmlExternalResFromThisJar(htmlExternalResRootDir, "js/share/testdoc-resolver.js");
        extractHtmlExternalResFromThisJar(htmlExternalResRootDir, "css/fonts/flexslider-icon.eot");
        extractHtmlExternalResFromThisJar(htmlExternalResRootDir, "css/fonts/flexslider-icon.svg");
        extractHtmlExternalResFromThisJar(htmlExternalResRootDir, "css/fonts/flexslider-icon.ttf");
        extractHtmlExternalResFromThisJar(htmlExternalResRootDir, "css/fonts/flexslider-icon.woff");
        extractHtmlExternalResFromThisJar(htmlExternalResRootDir, "css/images/bx_loader.gif");
        extractHtmlExternalResFromThisJar(htmlExternalResRootDir, "css/images/controls.png");
        extractHtmlExternalResFromThisJar(htmlExternalResRootDir, "css/jquery.bxslider.css");
        extractHtmlExternalResFromThisJar(htmlExternalResRootDir, "css/jquery.treetable.css");
        extractHtmlExternalResFromThisJar(htmlExternalResRootDir, "css/jquery.treetable.theme.default.css");
        extractHtmlExternalResFromThisJar(htmlExternalResRootDir, "css/perfect-scrollbar.min.css");
        extractHtmlExternalResFromThisJar(htmlExternalResRootDir, "css/report.css");
        extractHtmlExternalResFromThisJar(htmlExternalResRootDir, "images/noImage.png");
        extractHtmlExternalResFromThisJar(htmlExternalResRootDir, "js/report/jquery-1.11.1.min.js");
        extractHtmlExternalResFromThisJar(htmlExternalResRootDir, "js/report/jquery.bxslider.min.js");
        extractHtmlExternalResFromThisJar(htmlExternalResRootDir, "js/report/jquery.treetable.js");
        extractHtmlExternalResFromThisJar(htmlExternalResRootDir, "js/report/perfect-scrollbar.min.js");
        extractHtmlExternalResFromThisJar(htmlExternalResRootDir, "js/report/report.js");

        // copy screen captures to reportOutputDir
        // TODO copying screen capture may be slow action
        File htmlReportCaptureRootDir = CommonPath.htmlReportCaptureRootDir(reportOutputDir);
        for (File reportInputDataDir : reportInputDataDirs) {
            File inputCaptureRootDir = CommonPath.inputCaptureRootDir(reportInputDataDir);
            try {
                if (inputCaptureRootDir.exists()) {
                    // assume runResults for each reportInputDataDir has different root method run results
                    // and the capture files are not overwritten.
                    FileUtils.copyDirectory(inputCaptureRootDir, htmlReportCaptureRootDir);
                }
            } catch (IOException e) {
                throw new RuntimeException(e);
            }
        }

        List<TestMethod> testMethods = srcTree.getRootMethodTable().getTestMethods();
        File reportMainDir = CommonPath.htmlReportMainFile(reportOutputDir).getParentFile();
        List<ReportMethodLink> reportLinks = new ArrayList<>(testMethods.size());

        // generate each method report
        for (TestMethod rootMethod : testMethods) {
            TestMethod method = rootMethod;
            // use encoded test class name to avoid various possible file name encoding problem
            // TODO use java.nio.charset.StandardCharsets
            File methodReportParentDir= new File(CommonPath.methodHtmlReportRootDir(reportOutputDir),
                        CommonUtils.encodeToSafeAsciiFileNameString(method.getTestClass().getQualifiedName(), StandardCharsets.UTF_8));
            methodReportParentDir.mkdirs();

            VelocityContext methodContext = new VelocityContext();
            methodContext.put("number", new NumberTool());
            methodContext.put("math", new MathTool());
            if (rootMethod.getTestDoc() == null) {
                escapePut(methodContext, "title", rootMethod.getSimpleName());
            } else {
                escapePut(methodContext, "title", rootMethod.getTestDoc());
            }

            String externalResourceRootDir =  CommonUtils.relativize(
                    CommonPath.htmlExternalResourceRootDir(reportOutputDir), methodReportParentDir).getPath();
            // URL separator is always slash regardless of OS type
            escapePut(methodContext, "externalResourceRootDir",
                    FilenameUtils.separatorsToUnix(externalResourceRootDir));
            if (!(rootMethod instanceof TestMethod)) {
                throw new RuntimeException("not supported yet: " + rootMethod);
            }

            escapePut(methodContext, "className", method.getTestClass().getQualifiedName());
            escapePut(methodContext, "classTestDoc", method.getTestClass().getTestDoc());
            escapePut(methodContext, "methodName", rootMethod.getSimpleName());
            escapePut(methodContext, "methodTestDoc", rootMethod.getTestDoc());
            escapePut(methodContext, "timeUnit", SysMessages.get(SysMessages.REPORT_TIME_UNIT));
            escapePut(methodContext, "msgShowCode", SysMessages.get(SysMessages.REPORT_SHOW_CODE));
            escapePut(methodContext, "msgHideCode", SysMessages.get(SysMessages.REPORT_HIDE_CODE));
            // TODO js logic should construct message according to the user locale
            // without any information passed from the java logic
            escapePut(methodContext, "codeLineWithoutTestDoc",
                    SysMessages.get(SysMessages.CODE_LINE_WITHOUT_TEST_DOC));
            escapePut(methodContext, "jsLocalVar", SysMessages.get(SysMessages.JS_LOCAL_VAR));
            escapePut(methodContext, "jsVarAssign", SysMessages.get(SysMessages.JS_VAR_ASSIGN));
            RootMethodRunResult runResult = null;
            File inputCaptureRootDir = null;
            for (int i = 0; i < runResultsList.size(); i++) {
                runResult = runResultsList.get(i).getRunResultByRootMethod(rootMethod);
                if (runResult != null) {
                    inputCaptureRootDir = CommonPath.inputCaptureRootDir(reportInputDataDirs.get(i));
                    escapePut(methodContext, "executionTime", Integer.toString(runResult.getExecutionTime()));
                    break; // assume results for each runResults are for different root method
                }
            }
            boolean executed = (runResult != null);
            RunFailure runFailure = getRunFailure(runResult);
            if (runFailure == null) {
                escapePut(methodContext, "errMsg", null);
                escapePut(methodContext, "errLineTtId", "");
            } else {
                escapePut(methodContext, "errMsg", runFailure.getMessage().trim());
                escapePut(methodContext, "errLineTtId", generateTtId(runFailure.getStackLines()));
            }

            List<ReportCodeLine> reportCodeBody
            = generateReportCodeBody(rootMethod, runFailure, executed);
            methodContext.put("codeBody", reportCodeBody);

            List<LineScreenCapture> lineScreenCaptures;
            if (runResult == null) {
                lineScreenCaptures = new ArrayList<>(0);
            } else {
                lineScreenCaptures = runResult.getLineScreenCaptures();
                // TODO execution-time tag is used in HTML report now,
                // but should use data-execution-time tag
                addExecutionTimeToCodeBody(lineScreenCaptures, reportCodeBody);
            }
            addLineScreenCaptureForErrorEachStackLine(lineScreenCaptures, runFailure);
            List<ReportScreenCapture> captures = generateReportScreenCaptures(
                    lineScreenCaptures, inputCaptureRootDir, reportOutputDir, methodReportParentDir);
            methodContext.put("captures", captures);

            // use encoded method name to avoid various possible file name encoding problem
            // and to escape invalid file name character (Method name may contain such characters
            // if method is Groovy method, for example).
            File methodReportFile = new File(methodReportParentDir,
                    CommonUtils.encodeToSafeAsciiFileNameString(rootMethod.getSimpleName(), StandardCharsets.UTF_8) + ".html");
            generateVelocityOutput(methodContext, "/template/report.html.vm", methodReportFile);

            // set reportLinks data
            ReportMethodLink reportLink = new ReportMethodLink();
            reportLink.setTitle(method.getQualifiedName());
            String reportLinkPath = CommonUtils.relativize(methodReportFile, reportMainDir).getPath();
            // URL separator is always slash regardless of OS type
            reportLink.setPath(FilenameUtils.separatorsToUnix(reportLinkPath));
            reportLinks.add(reportLink);
        }
        // TODO HTML encode all codeBody, captures, reportLinks values

        // generate main index.html report
        VelocityContext mainContext = new VelocityContext();
        mainContext.put("reportLinks", reportLinks);
        generateVelocityOutput(mainContext, "/template/index.html.vm",
                CommonPath.htmlReportMainFile(reportOutputDir));
    }
339450
@SuppressWarnings({"unchecked"})
  public void reduce(Object key, Iterator values, OutputCollector output,
                     Reporter reporter) throws IOException {
    Reducer reducer = chain.getReducer();
    if (reducer != null) {
      reducer.reduce(key, values, chain.getReducerCollector(output, reporter),
                     reporter);
    }
  }
58178
public void map(K1 key, V1 value,
                  OutputCollector<Text, Text> output, Reporter reporter) throws IOException {

    Iterator iter = this.aggregatorDescriptorList.iterator();
    while (iter.hasNext()) {
      ValueAggregatorDescriptor ad = (ValueAggregatorDescriptor) iter.next();
      Iterator<Entry<Text, Text>> ens =
        ad.generateKeyValPairs(key, value).iterator();
      while (ens.hasNext()) {
        Entry<Text, Text> en = ens.next();
        output.collect(en.getKey(), en.getValue());
      }
    }
  }
337904
public void generateReport (ClientObject caller, String type,
                                PeerService.ResultListener listener)
        throws InvocationException
    {
        listener.requestProcessed(_repmgr.generateReport(type));
    }
28950
public void report() {
        synchronized (this) {
            report(registry.getGauges(filter),
                    registry.getCounters(filter),
                    registry.getHistograms(filter),
                    registry.getMeters(filter),
                    registry.getTimers(filter));
        }
    }
21190
static void processReport(FSNamesystem namesystem, Collection<Block> toRetry,
      BlockListAsLongs newReport, DatanodeDescriptor node,
      ExecutorService initialBlockReportExecutor) throws IOException {
    // spawn one thread for blocksPerShardBR blocks
    int numShards = Math
        .min(
            namesystem.parallelProcessingThreads,
            ((newReport.getNumberOfBlocks()
                + namesystem.parallelBRblocksPerShard - 1) / namesystem.parallelBRblocksPerShard));
    List<Future<List<Block>>> workers = new ArrayList<Future<List<Block>>>(
        numShards);

    // submit tasks for execution
    for (int i = 0; i < numShards; i++) {
      workers.add(initialBlockReportExecutor.submit(new InitialReportWorker(
          newReport, i, numShards, node, namesystem.getNameNode()
              .shouldRetryAbsentBlocks(), namesystem)));
    }

    // get results and add to retry list if need
    try {
      for (Future<List<Block>> worker : workers) {
        if (namesystem.getNameNode().shouldRetryAbsentBlocks()) {
          toRetry.addAll(worker.get());
        } else {
          worker.get();
        }
      }
    } catch (ExecutionException e) {
      LOG.warn("Parallel report failed", e);
      throw new IOException(e);
    } catch (InterruptedException e) {
      throw new IOException("Interruption", e);
    }
  }