Java Code Examples for com.codahale.metrics.SharedMetricRegistries#remove()

The following examples show how to use com.codahale.metrics.SharedMetricRegistries#remove() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: SolrMetricManager.java    From lucene-solr with Apache License 2.0 6 votes vote down vote up
/**
 * Remove a named registry.
 *
 * @param registry name of the registry to remove
 */
public void removeRegistry(String registry) {
  // close any reporters for this registry first
  closeReporters(registry, null);
  // make sure we use a name with prefix
  registry = enforcePrefix(registry);
  if (isSharedRegistry(registry)) {
    SharedMetricRegistries.remove(registry);
  } else {
    swapLock.lock();
    try {
      registries.remove(registry);
    } finally {
      swapLock.unlock();
    }
  }
}
 
Example 2
Source File: VertxMetricsImpl.java    From vertx-dropwizard-metrics with Apache License 2.0 6 votes vote down vote up
@Override
public void close() {
  if (shutdown) {
    RegistryHelper.shutdown(registry);
    if (options.getRegistryName() != null) {
      SharedMetricRegistries.remove(options.getRegistryName());
    }
  }
  List<HttpClientReporter> reporters;
  synchronized (this) {
    reporters = new ArrayList<>(clientReporters.values());
  }
  for (HttpClientReporter reporter : reporters) {
    reporter.close();
  }
  if (doneHandler != null) {
    doneHandler.handle(null);
  }
}
 
Example 3
Source File: Metrics.java    From r2cloud with Apache License 2.0 5 votes vote down vote up
public void stop() {
	if (sigar != null) {
		sigar.close();
	}
	if (reporter != null) {
		reporter.close();
	}
	SharedHealthCheckRegistries.remove("r2cloud");
	SharedMetricRegistries.remove("r2cloud");
}
 
Example 4
Source File: NexusContextListener.java    From nexus-public with Eclipse Public License 1.0 5 votes vote down vote up
@Override
public void contextDestroyed(final ServletContextEvent event) {
  // event is ignored, apparently can also be null

  // remove our dynamic filter
  if (registration != null) {
    registration.unregister();
    registration = null;
  }

  // log uptime before triggering activity which may run into problems
  long uptime = ManagementFactory.getRuntimeMXBean().getUptime();
  log.info("Uptime: {} ({})", PeriodFormat.getDefault().print(new Period(uptime)),
      System.getProperty(NEXUS_FULL_EDITION, UNKNOWN));

  try {
    moveToPhase(OFF);
  }
  catch (final Exception e) {
    log.error("Failed to stop nexus", e);
  }

  extender.doStop(); // stop tracking bundles

  if (servletContext != null) {
    servletContext = null;
  }

  injector = null;

  SharedMetricRegistries.remove("nexus");
}