本文整理汇总了Java中com.codahale.metrics.Metric.getClass方法的典型用法代码示例。如果您正苦于以下问题:Java Metric.getClass方法的具体用法?Java Metric.getClass怎么用?Java Metric.getClass使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.codahale.metrics.Metric
的用法示例。
在下文中一共展示了Metric.getClass方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: notifyListenerOfAddedMetric
import com.codahale.metrics.Metric; //导入方法依赖的package包/类
private void notifyListenerOfAddedMetric(
final SemanticMetricRegistryListener listener, final Metric metric, final MetricId name
) {
if (metric instanceof Gauge) {
listener.onGaugeAdded(name, (Gauge<?>) metric);
} else if (metric instanceof Counter) {
listener.onCounterAdded(name, (Counter) metric);
} else if (metric instanceof Histogram) {
listener.onHistogramAdded(name, (Histogram) metric);
} else if (metric instanceof Meter) {
listener.onMeterAdded(name, (Meter) metric);
} else if (metric instanceof Timer) {
listener.onTimerAdded(name, (Timer) metric);
} else if (metric instanceof DerivingMeter) {
listener.onDerivingMeterAdded(name, (DerivingMeter) metric);
} else {
throw new IllegalArgumentException("Unknown metric type: " + metric.getClass());
}
}
示例2: notifyListenerOfRemovedMetric
import com.codahale.metrics.Metric; //导入方法依赖的package包/类
private void notifyListenerOfRemovedMetric(
final MetricId name, final Metric metric, final SemanticMetricRegistryListener listener
) {
if (metric instanceof Gauge) {
listener.onGaugeRemoved(name);
} else if (metric instanceof Counter) {
listener.onCounterRemoved(name);
} else if (metric instanceof Histogram) {
listener.onHistogramRemoved(name);
} else if (metric instanceof Meter) {
listener.onMeterRemoved(name);
} else if (metric instanceof Timer) {
listener.onTimerRemoved(name);
} else if (metric instanceof DerivingMeter) {
listener.onDerivingMeterRemoved(name);
} else {
throw new IllegalArgumentException("Unknown metric type: " + metric.getClass());
}
}
示例3: notifyListenerOfAddedMetric
import com.codahale.metrics.Metric; //导入方法依赖的package包/类
private void notifyListenerOfAddedMetric(
final MetricRegistryListener listener, final Metric metric, final String name
) {
if(metric instanceof Gauge) {
listener.onGaugeAdded(name, (Gauge<?>) metric);
} else if(metric instanceof Counter) {
listener.onCounterAdded(name, (Counter) metric);
} else if(metric instanceof Histogram) {
listener.onHistogramAdded(name, (Histogram) metric);
} else if(metric instanceof Meter) {
listener.onMeterAdded(name, (Meter) metric);
} else if(metric instanceof Timer) {
listener.onTimerAdded(name, (Timer) metric);
} else {
throw new IllegalArgumentException("Unsupported metric type: " + metric.getClass());
}
}
示例4: notifyListenerOfRemovedMetric
import com.codahale.metrics.Metric; //导入方法依赖的package包/类
private void notifyListenerOfRemovedMetric(
final String name, final Metric metric, final MetricRegistryListener listener
) {
if(metric instanceof Gauge) {
listener.onGaugeRemoved(name);
} else if(metric instanceof Counter) {
listener.onCounterRemoved(name);
} else if(metric instanceof Histogram) {
listener.onHistogramRemoved(name);
} else if(metric instanceof Meter) {
listener.onMeterRemoved(name);
} else if(metric instanceof Timer) {
listener.onTimerRemoved(name);
} else {
throw new IllegalArgumentException("Unsupported metric type: " + metric.getClass());
}
}
示例5: getPostfixForMetric
import com.codahale.metrics.Metric; //导入方法依赖的package包/类
private String getPostfixForMetric(Metric metric) {
Preconditions.checkNotNull(metric);
Class<? extends Metric> metricClass = metric.getClass();
if (Counter.class.isAssignableFrom(metricClass)) {
return COUNTER_POSTFIX;
} else if (Gauge.class.isAssignableFrom(metricClass)) {
return GAUGE_POSTFIX;
} else if (Timer.class.isAssignableFrom(metricClass)) {
return TIMER_POSTFIX;
} else if (Meter.class.isAssignableFrom(metricClass)) {
return METER_POSTFIX;
} else if (Histogram.class.isAssignableFrom(metricClass)) {
return HISTOGRAM_POSTFIX;
} else {
return null;
}
}