本文整理汇总了Java中org.apache.hadoop.metrics2.lib.MutableGaugeLong类的典型用法代码示例。如果您正苦于以下问题:Java MutableGaugeLong类的具体用法?Java MutableGaugeLong怎么用?Java MutableGaugeLong使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
MutableGaugeLong类属于org.apache.hadoop.metrics2.lib包,在下文中一共展示了MutableGaugeLong类的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: testSetGauge
import org.apache.hadoop.metrics2.lib.MutableGaugeLong; //导入依赖的package包/类
@Test
public void testSetGauge() throws Exception {
bmsi.setGauge("testset", 100);
assertEquals(100, ((MutableGaugeLong) bmsi.metricsRegistry.get("testset")).value());
bmsi.setGauge("testset", 300);
assertEquals(300, ((MutableGaugeLong) bmsi.metricsRegistry.get("testset")).value());
}
示例2: testIncGauge
import org.apache.hadoop.metrics2.lib.MutableGaugeLong; //导入依赖的package包/类
@Test
public void testIncGauge() throws Exception {
bmsi.incGauge("testincgauge", 100);
assertEquals(100, ((MutableGaugeLong) bmsi.metricsRegistry.get("testincgauge")).value());
bmsi.incGauge("testincgauge", 100);
assertEquals(200, ((MutableGaugeLong) bmsi.metricsRegistry.get("testincgauge")).value());
}
示例3: testDecGauge
import org.apache.hadoop.metrics2.lib.MutableGaugeLong; //导入依赖的package包/类
@Test
public void testDecGauge() throws Exception {
bmsi.decGauge("testdec", 100);
assertEquals(-100, ((MutableGaugeLong) bmsi.metricsRegistry.get("testdec")).value());
bmsi.decGauge("testdec", 100);
assertEquals(-200, ((MutableGaugeLong) bmsi.metricsRegistry.get("testdec")).value());
}
示例4: clearMetricIfNotNull
import org.apache.hadoop.metrics2.lib.MutableGaugeLong; //导入依赖的package包/类
private static void clearMetricIfNotNull(MutableGaugeLong metric) {
if (metric != null) {
metric.set(0L);
}
}
示例5: setGauge
import org.apache.hadoop.metrics2.lib.MutableGaugeLong; //导入依赖的package包/类
/**
* Set a single gauge to a value.
*
* @param gaugeName gauge name
* @param value the new value of the gauge.
*/
public void setGauge(String gaugeName, long value) {
MutableGaugeLong gaugeInt = metricsRegistry.getLongGauge(gaugeName, value);
gaugeInt.set(value);
}
示例6: incGauge
import org.apache.hadoop.metrics2.lib.MutableGaugeLong; //导入依赖的package包/类
/**
* Add some amount to a gauge.
*
* @param gaugeName The name of the gauge to increment.
* @param delta The amount to increment the gauge by.
*/
public void incGauge(String gaugeName, long delta) {
MutableGaugeLong gaugeInt = metricsRegistry.getLongGauge(gaugeName, 0l);
gaugeInt.incr(delta);
}
示例7: decGauge
import org.apache.hadoop.metrics2.lib.MutableGaugeLong; //导入依赖的package包/类
/**
* Decrease the value of a named gauge.
*
* @param gaugeName The name of the gauge.
* @param delta the ammount to subtract from a gauge value.
*/
public void decGauge(String gaugeName, long delta) {
MutableGaugeLong gaugeInt = metricsRegistry.getLongGauge(gaugeName, 0l);
gaugeInt.decr(delta);
}
示例8: setGauge
import org.apache.hadoop.metrics2.lib.MutableGaugeLong; //导入依赖的package包/类
/**
* Set a single gauge to a value.
*
* @param gaugeName gauge name
* @param value the new value of the gauge.
*/
public void setGauge(String gaugeName, long value) {
MutableGaugeLong gaugeInt = metricsRegistry.getGauge(gaugeName, value);
gaugeInt.set(value);
}
示例9: incGauge
import org.apache.hadoop.metrics2.lib.MutableGaugeLong; //导入依赖的package包/类
/**
* Add some amount to a gauge.
*
* @param gaugeName The name of the gauge to increment.
* @param delta The amount to increment the gauge by.
*/
public void incGauge(String gaugeName, long delta) {
MutableGaugeLong gaugeInt = metricsRegistry.getGauge(gaugeName, 0l);
gaugeInt.incr(delta);
}
示例10: decGauge
import org.apache.hadoop.metrics2.lib.MutableGaugeLong; //导入依赖的package包/类
/**
* Decrease the value of a named gauge.
*
* @param gaugeName The name of the gauge.
* @param delta the ammount to subtract from a gauge value.
*/
public void decGauge(String gaugeName, long delta) {
MutableGaugeLong gaugeInt = metricsRegistry.getGauge(gaugeName, 0l);
gaugeInt.decr(delta);
}