/** * Stop a {@link ConsoleReporter} previously created by a call to * {@link #addConsoleReporter(long)} and release it for GC. Idempotent * between calls to the associated add method. Does nothing before the first * call to the associated add method. */ public synchronized void removeConsoleReporter() { if (null != consoleReporter) consoleReporter.stop(); consoleReporter = null; }
@Override public void stop() { mReporter.stop(); }
/** * Stop a {@link ConsoleReporter} previously created by a call to * {@link #addConsoleReporter(Duration)} and release it for GC. Idempotent * between calls to the associated add method. Does nothing before the first * call to the associated add method. */ public synchronized void removeConsoleReporter() { if (null != consoleReporter) consoleReporter.stop(); consoleReporter = null; }
@Override public void stop() { if (reporter != null) { LOG.debug("Stopping..."); reporter.report(); reporter.stop(); } else { throw new IllegalStateException("Attempt to stop without preparing " + getClass().getSimpleName()); } } }
/** * Stop a {@link ConsoleReporter} previously created by a call to * {@link #addConsoleReporter(long)} and release it for GC. Idempotent * between calls to the associated add method. Does nothing before the first * call to the associated add method. */ public synchronized void removeConsoleReporter() { if (null != consoleReporter) consoleReporter.stop(); consoleReporter = null; }
/** * Stop a {@link ConsoleReporter} previously created by a call to * {@link #addConsoleReporter(long)} and release it for GC. Idempotent * between calls to the associated add method. Does nothing before the first * call to the associated add method. */ public synchronized void removeConsoleReporter() { if (null != consoleReporter) consoleReporter.stop(); consoleReporter = null; }
@Override public void stop() { mReporter.stop(); }
/** * Stop a {@link ConsoleReporter} previously created by a call to * {@link #addConsoleReporter(long)} and release it for GC. Idempotent * between calls to the associated add method. Does nothing before the first * call to the associated add method. */ public synchronized void removeConsoleReporter() { if (null != consoleReporter) consoleReporter.stop(); consoleReporter = null; }
/** * Stop a {@link ConsoleReporter} previously created by a call to * {@link #addConsoleReporter(long)} and release it for GC. Idempotent * between calls to the associated add method. Does nothing before the first * call to the associated add method. */ public synchronized void removeConsoleReporter() { if (null != consoleReporter) consoleReporter.stop(); consoleReporter = null; }
@Override public void stop() { mReporter.stop(); }
@Override public void stopReporter() { try { consoleReporter.stop(); consoleReporter = null; } catch (Throwable e) { logger.error("An error occurred when trying to stop the reporter", e); } }
@Override public void stop() { if (reporter != null) { LOG.debug("Stopping..."); reporter.stop(); } else { throw new IllegalStateException("Attempt to stop without preparing " + getClass().getSimpleName()); } } }
@Override public void stop() { reporter.stop(); reporter.close(); }
void shutdown() throws InterruptedException { // Trigger shutdown on all threads for (Worker w : m_threads) { w.shutdown(); } for (Worker w : m_threads) { w.join(); } m_reporter.stop(); }
@Override public void teardownTest(JavaSamplerContext context) { if (cloudSolrClient != null) { int refs = refCounter.decrementAndGet(); if (refs == 0) { if (slowQueryLogger != null) { try { slowQueryLogger.flush(); slowQueryLogger.close(); } catch (IOException e) { e.printStackTrace(); } } if (reporter != null) { reporter.report(); reporter.stop(); } /* try { cloudSolrClient.shutdown(); } catch (Exception ignore) {} */ cloudSolrClient = null; log.info("Shutdown CloudSolrClient."); } } super.teardownTest(context); }
@Override public void teardownTest(JavaSamplerContext context) { log.info("In teardownTest for thread: "+Thread.currentThread().getName()); int refs = refCounter.decrementAndGet(); if (refs <= 0) { if (commitAtEnd && cloudSolrClient != null) { log.info("Sending final commit to SolrCloud."); try { cloudSolrClient.commit(); } catch (Exception e) { log.error("Failed to commit due to: " + e, e); } } if (reporter != null) { reporter.report(); reporter.stop(); } if (cloudSolrClient != null) { /* try { cloudSolrClient.shutdown(); } catch (Exception ignore) { } */ cloudSolrClient = null; log.info("Shutdown CloudSolrClient."); } } super.teardownTest(context); }
} finally { reporter.stop();
@Override public void teardownTest(JavaSamplerContext context) { if (cloudSolrClient != null) { int refs = refCounter.decrementAndGet(); if (refs == 0) { if (reporter != null) { reporter.report(); reporter.stop(); } try { cloudSolrClient.close(); } catch (Exception ignore) { } cloudSolrClient = null; log.info("Shutdown CloudSolrClient."); if (fusionPipelineClient != null) { fusionPipelineClient.shutdown(); fusionPipelineClient = null; } } } super.teardownTest(context); }
public static void main(final String[] args) { final MetricRegistry metricRegistry = new MetricRegistry(); new GcMemoryMetrics("demo", metricRegistry); final ConsoleReporter reporter = ConsoleReporter .forRegistry(metricRegistry) .build(); reporter.start(1, TimeUnit.SECONDS); while (true) { try { System.gc(); Thread.sleep(Duration.ofSeconds(1).toMillis()); } catch (@SuppressWarnings("unused") final InterruptedException e) { Thread.currentThread().interrupt(); break; } } reporter.stop(); reporter.close(); } }
public static void loadOrPrint(File templateFile, Stream<Map<String, Object>> data, MigrationOptions options){ String template = fileAsString(templateFile); Migrator migrator = new MigratorBuilder() .setUri(options.getUri()) .setMigrationOptions(options) .setKeyspace(options.getKeyspace()) .build(); if(options.isNo()){ migrator.print(template, data); } else { printInitMessage(options); migrator.getReporter().start(1, TimeUnit.MINUTES); try { migrator.load(template, data); } catch (Throwable e) { // This is to catch migration exceptions and return intelligible output messages StringBuilder message = CommonUtil.simplifyExceptionMessage(e); System.out.println("ERROR: Exception while loading data (disabling debug mode might skip and continue): " + message.toString()); } finally { migrator.getReporter().stop(); } printWholeCompletionMessage(options); } }