當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。