com.codahale.metrics.graphite.Graphite.close()方法的使用及代码示例

x33g5p2x  于2022-01-19 转载在 其他  
字(2.5k)|赞(0)|评价(0)|浏览(111)

本文整理了Java中com.codahale.metrics.graphite.Graphite.close()方法的一些代码示例,展示了Graphite.close()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Graphite.close()方法的具体详情如下:
包路径:com.codahale.metrics.graphite.Graphite
类名称:Graphite
方法名:close

Graphite.close介绍

暂无

代码示例

代码示例来源:origin: HubSpot/Singularity

@Override
public void stop() throws Exception {
 if (graphite != null) {
  LOG.info("Closing GraphiteSender");
  graphite.close();
  LOG.info("Closed GraphiteSender");
 }
 if (reporter != null) {
  LOG.info("Closing GraphiteReporter");
  reporter.stop();
  LOG.info("Closed GraphiteReporter");
 }
}

代码示例来源:origin: com.opentable.components/otj-metrics-core

@Override
public synchronized void close() throws IOException {
  try {
    delegate.close();
  } finally {
    connectionCloses.inc();
  }
}

代码示例来源:origin: com.opentable.components/otj-metrics-core

private void closeOldGraphite() {
  if (delegate != null) {
    try {
      delegate.close();
    } catch (Exception e) {
      LOG.error("Failed to close old graphite", e);
    }
  }
}

代码示例来源:origin: Kixeye/chassis

@PreDestroy
public void stop() {
  this.graphiteReporter.stop();
  try {
    this.graphite.close();
  } catch (IOException e) {
    logger.warn("Failed to close graphite",e);
  }
}

代码示例来源:origin: com.hubspot/SingularityService

@Override
public void stop() throws Exception {
 if (graphite != null) {
  LOG.info("Closing GraphiteSender");
  graphite.close();
  LOG.info("Closed GraphiteSender");
 }
 if (reporter != null) {
  LOG.info("Closing GraphiteReporter");
  reporter.stop();
  LOG.info("Closed GraphiteReporter");
 }
}

代码示例来源:origin: ru.yandex.qatools.camelot.utils/plugin-utils

@Processor
  public void process(GraphiteValue event) {
    if (isBlank(host)) {
      return;
    }

    logger.info(format("Sending %s to graphite at %s:%d", event, host, port));
    try {
      Graphite graphite = new Graphite(new InetSocketAddress(host, port));
      graphite.connect();
      graphite.send(event.getName(), event.getValue(), event.getTimestamp());
      graphite.close();
    } catch (IOException e) {
      logger.error("Failed to stream value to graphite:", e);
    }
  }
}

代码示例来源:origin: OpenSOC/opensoc-streaming

graphite.close();

代码示例来源:origin: aseigneurin/kafka-sandbox

public void send(CounterMetric metric) {
  try {
    if (!graphite.isConnected()) {
      graphite.connect();
    }
    graphite.send(metric.getName() + ".count", Long.toString(metric.getValue()), metric.getTimestampInMillis());
    graphite.flush();
  } catch (IOException e) {
    LOGGER.warn("Unable to report to Graphite", graphite, e);
    try {
      graphite.close();
    } catch (IOException e1) {
      LOGGER.warn("Error closing Graphite", graphite, e);
    }
  }
}

相关文章