本文整理汇总了Java中com.codahale.metrics.ScheduledReporter.stop方法的典型用法代码示例。如果您正苦于以下问题:Java ScheduledReporter.stop方法的具体用法?Java ScheduledReporter.stop怎么用?Java ScheduledReporter.stop使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.codahale.metrics.ScheduledReporter
的用法示例。
在下文中一共展示了ScheduledReporter.stop方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: shutDown
import com.codahale.metrics.ScheduledReporter; //导入方法依赖的package包/类
@Override
protected void shutDown() throws Exception {
for (ScheduledReporter entry : reporter.values()) {
LOG.debug("Stopping metrics reporter: {}", entry);
entry.stop();
}
}
示例2: stopMetrics
import com.codahale.metrics.ScheduledReporter; //导入方法依赖的package包/类
@Override
public void stopMetrics() {
for (ScheduledReporter r : reporters) {
r.report();
LOG.info("Stopping reporter {}", r.toString());
r.stop();
}
}
示例3: close
import com.codahale.metrics.ScheduledReporter; //导入方法依赖的package包/类
@Synchronized
@Override
public void close() {
for (ScheduledReporter r : reporters) {
try {
r.report();
r.stop();
} catch (Exception e) {
log.error("Exception report or stop reporter", e);
}
}
metrics.removeMatching(MetricFilter.ALL);
}
示例4: main
import com.codahale.metrics.ScheduledReporter; //导入方法依赖的package包/类
public static void main(String[] args) {
InfluxDbReporter influxDbReporter = null;
ScheduledReporter consoleReporter = null;
Timer.Context context = null;
try {
final MetricRegistry registry = new MetricRegistry();
consoleReporter = startConsoleReporter(registry);
influxDbReporter = startInfluxDbReporter(registry, GetHttpSender());
final Meter myMeter = registry.meter(MetricRegistry.name(SendToLocalInfluxDB.class, "testMetric"));
final Timer myTimer = registry.timer("testTimer");
context = myTimer.time();
for (int i = 0; i < 5000; i++) {
myMeter.mark();
myMeter.mark(Math.round(Math.random() * 100.0));
Thread.sleep(2000);
}
} catch (Exception exc) {
exc.printStackTrace();
System.exit(1);
} finally {
if (context != null) {
context.stop();
}
if (influxDbReporter != null) {
influxDbReporter.report();
influxDbReporter.stop();
}
if (consoleReporter != null) {
consoleReporter.report();
consoleReporter.stop();
}
System.out.println("Finished");
}
}
示例5: shutdown
import com.codahale.metrics.ScheduledReporter; //导入方法依赖的package包/类
/**
* Shuts down the handler instance
*/
public void shutdown() {
for(final JmxReporter jmxReporter : jmxReporters.values()) {
jmxReporter.stop();
}
jmxReporters.clear();
for(final ScheduledReporter scheduledReporter : scheduledReporters.values()) {
scheduledReporter.stop();
}
scheduledReporters.clear();
}
示例6: removeScheduledReporter
import com.codahale.metrics.ScheduledReporter; //导入方法依赖的package包/类
/**
* {@link ScheduledReporter#stop() Stops} the referenced {@link ScheduledReporter} and removes it from
* map of managed scheduled reporters
* @param id
*/
public void removeScheduledReporter(final String id) {
String key = StringUtils.lowerCase(StringUtils.trim(id));
ScheduledReporter scheduledReporter = this.scheduledReporters.get(key);
if(scheduledReporter != null) {
scheduledReporter.stop();
this.scheduledReporters.remove(key);
}
}
示例7: stopScheduledReporter
import com.codahale.metrics.ScheduledReporter; //导入方法依赖的package包/类
/**
* {@link ScheduledReporter#stop() Stops} the referenced {@link ScheduledReporter} but keeps it referenced
* @param id
*/
public void stopScheduledReporter(final String id) {
String key = StringUtils.lowerCase(StringUtils.trim(id));
ScheduledReporter scheduledReporter = this.scheduledReporters.get(key);
if(scheduledReporter != null) {
scheduledReporter.stop();
}
}
示例8: shutdown
import com.codahale.metrics.ScheduledReporter; //导入方法依赖的package包/类
public void shutdown() {
cluster.close();
for (ScheduledReporter reporter : reporters) {
reporter.report();
reporter.stop();
}
}
示例9: main
import com.codahale.metrics.ScheduledReporter; //导入方法依赖的package包/类
public static void main(String[] args) {
ScheduledReporter r0 = null;
ScheduledReporter r1 = null;
try {
final MetricRegistry registry = new MetricRegistry();
r0 = startConsoleReporter(registry);
r1 = startInfluxdbReporter(registry);
registerGaugeWithValues(registry, "double", Double.NaN, Double.NEGATIVE_INFINITY, Double.POSITIVE_INFINITY, 1);
registerGaugeWithValues(registry, "float", Float.NaN, Float.NEGATIVE_INFINITY, Float.POSITIVE_INFINITY, 1);
final Meter mymeter0 = registry.meter("MyMeter.0");
for (int i = 0; i < 100; i++) {
mymeter0.mark();
mymeter0.mark(Math.round(Math.random() * 100.0));
Thread.sleep(Math.round(Math.random() * 1000.0));
}
} catch (Exception exc) {
exc.printStackTrace();
System.exit(1);
} finally {
if (r1 != null) {
r1.report();
r1.stop();
}
if (r0 != null) {
r0.report();
r0.stop();
}
System.out.println("STOP");
}
}
示例10: stop
import com.codahale.metrics.ScheduledReporter; //导入方法依赖的package包/类
@Override public void stop() {
for (ScheduledReporter reporter : reporters) {
reporter.stop();
}
}
示例11: stopMetricReporting
import com.codahale.metrics.ScheduledReporter; //导入方法依赖的package包/类
/**
* Stop all the {@link com.codahale.metrics.ScheduledReporter}s associated with this {@link MetricContext}.
*/
public void stopMetricReporting() {
for (ScheduledReporter reporter : this.contextAwareScheduledReporters.values()) {
reporter.stop();
}
}
示例12: main
import com.codahale.metrics.ScheduledReporter; //导入方法依赖的package包/类
public static void main(String[] args) {
ScheduledReporter r0 = null;
ScheduledReporter r1 = null;
ScheduledReporter r2 = null;
try {
final MetricRegistry registry = new MetricRegistry();
r0 = startConsoleReporter(registry);
r1 = startInfluxdbReporterHttpV09(registry);
r2 = startInfluxdbReporterUDPV09(registry);
// TODO what to do with NaN & infinity
registerGaugeWithValues(registry, "integer", Integer.MIN_VALUE, Integer.MAX_VALUE, 1);
registerGaugeWithValues(registry, "long", Long.MIN_VALUE, Long.MAX_VALUE, 1l);
registerGaugeWithValues(registry, "double", Double.NaN, Double.NEGATIVE_INFINITY, Double.POSITIVE_INFINITY, 1.0d);
registerGaugeWithValues(registry, "float", Float.NaN, Float.NEGATIVE_INFINITY, Float.POSITIVE_INFINITY, 1.0f);
final Meter mymeter0 = registry.meter("MyMeter.0");
for (int i = 0; i < 100; i++) {
mymeter0.mark();
mymeter0.mark(Math.round(Math.random() * 100.0));
Thread.sleep(Math.round(Math.random() * 1000.0));
}
} catch (Exception exc) {
exc.printStackTrace();
System.exit(1);
} finally {
if (r2 != null) {
r2.report();
r2.stop();
}
if (r1 != null) {
r1.report();
r1.stop();
}
if (r0 != null) {
r0.report();
r0.stop();
}
System.out.println("STOP");
}
}