当前位置: 首页>>代码示例>>Java>>正文


Java Metric.getClass方法代码示例

本文整理汇总了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());
    }
}
 
开发者ID:spotify,项目名称:semantic-metrics,代码行数:20,代码来源:SemanticMetricRegistry.java

示例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());
    }
}
 
开发者ID:spotify,项目名称:semantic-metrics,代码行数:20,代码来源:SemanticMetricRegistry.java

示例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());
	}
}
 
开发者ID:emc-mongoose,项目名称:mongoose-base,代码行数:18,代码来源:CustomMetricRegistry.java

示例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());
	}
}
 
开发者ID:emc-mongoose,项目名称:mongoose-base,代码行数:18,代码来源:CustomMetricRegistry.java

示例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;
    }
}
 
开发者ID:centro,项目名称:monitoring-center,代码行数:19,代码来源:MetricCollectorImpl.java


注:本文中的com.codahale.metrics.Metric.getClass方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。