Map<File, CsvReporter> reporters = REGISTRIES.get(registry);
if (reporters == null) {
reporters = Maps.newHashMap();
REGISTRIES.put(registry, reporters);
}
CsvReporter reporter = reporters.get(outputDir);
if (reporter == null) {
Builder reporterBuilder = CsvReporter.forRegistry(registry)
.filter(filter)
.convertDurationsTo(defaultDurationUnit)
.convertRatesTo(defaultRateUnit)
.formatFor(locale);
reporter = reporterBuilder.build(outputDir);
outputDir.mkdirs();
if (!outputDir.isDirectory()) {
throw new MorphlineCompilationException("Directory not found: " + outputDir, config);
}
if (!outputDir.canWrite()) {
throw new MorphlineCompilationException("Directory not writeable: " + outputDir, config);
}
reporter.start(frequency, TimeUnit.NANOSECONDS);
reporters.put(outputDir, reporter);
}
}
}