use of org.apache.hadoop.hbase.metrics.Counter in project hbase by apache.
the class TestMetricRegistryImpl method testDoubleRegister.
@Test
public void testDoubleRegister() {
Gauge g1 = registry.register("mygauge", () -> 42L);
Gauge g2 = registry.register("mygauge", () -> 52L);
// second gauge is ignored if it exists
assertEquals(g1, g2);
Optional<Metric> metric = registry.get("mygauge");
assertTrue(metric.isPresent());
assertEquals(42L, (long) ((Gauge<Long>) metric.get()).getValue());
Counter c1 = registry.counter("mycounter");
Counter c2 = registry.counter("mycounter");
assertEquals(c1, c2);
}
Aggregations