//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#: //ORIGINAL LINE: public void init() throws java.io.IOException public override void Init() { // Setup CSV reporting File configuredPath = _config.get(csvPath); if (configuredPath == null) { throw new System.ArgumentException(csvPath.name() + " configuration is required since " + csvEnabled.name() + " is enabled"); } long?rotationThreshold = _config.get(MetricsSettings.csvRotationThreshold); int? maxArchives = _config.get(MetricsSettings.csvMaxArchives); _outputPath = AbsoluteFileOrRelativeTo(_kernelContext.directory(), configuredPath); _csvReporter = RotatableCsvReporter.ForRegistry(_registry).convertRatesTo(TimeUnit.SECONDS).convertDurationsTo(TimeUnit.MILLISECONDS).formatFor(Locale.US).outputStreamSupplierFactory(GetFileRotatingFileOutputStreamSupplier(rotationThreshold, maxArchives)).build(EnsureDirectoryExists(_outputPath)); }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void stopAllWritersOnStop() throws java.io.IOException //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#: public virtual void StopAllWritersOnStop() { Stream outputStream = mock(typeof(Stream)); when(_fileOutputStreamSupplier.get()).thenReturn(outputStream); RotatableCsvReporter reporter = new RotatableCsvReporter(mock(typeof(MetricRegistry)), Locale.US, TimeUnit.SECONDS, TimeUnit.SECONDS, Clock.defaultClock(), TestDirectory.directory(), (file, rotationListener) => _fileOutputStreamSupplier); SortedDictionary <string, Gauge> gauges = new SortedDictionary <string, Gauge>(); gauges["a"] = () => ThreadLocalRandom.current().nextLong(); gauges["b"] = () => ThreadLocalRandom.current().nextLong(); gauges["c"] = () => ThreadLocalRandom.current().nextLong(); reporter.report(gauges, new SortedDictionary <>(), new SortedDictionary <>(), new SortedDictionary <>(), new SortedDictionary <>()); gauges["b"] = () => ThreadLocalRandom.current().nextLong(); gauges["c"] = () => ThreadLocalRandom.current().nextLong(); gauges["d"] = () => ThreadLocalRandom.current().nextLong(); reporter.report(gauges, new SortedDictionary <>(), new SortedDictionary <>(), new SortedDictionary <>(), new SortedDictionary <>()); reporter.Stop(); verify(_fileOutputStreamSupplier, times(4)).close(); }
public override void Shutdown() { _csvReporter = null; }