@Test public void memoizesRegistriesByName() throws Exception { final MetricRegistry one = SharedMetricRegistries.getOrCreate("one"); final MetricRegistry two = SharedMetricRegistries.getOrCreate("one"); assertThat(one) .isSameAs(two); }
public static MetricRegistry getOrCreate(String name) { final MetricRegistry existing = REGISTRIES.get(name); if (existing == null) { final MetricRegistry created = new MetricRegistryImpl(); final MetricRegistry raced = add(name, created); if (raced == null) { return created; } return raced; } return existing; }
SharedMetricRegistries { public static MetricRegistry getOrCreate(String name) { final MetricRegistry existing = REGISTRIES.get(name); if (existing == null) { final MetricRegistry created = new MetricRegistryImpl(); final MetricRegistry raced = add(name, created); if (raced == null) { return created; } return raced; } return existing; } }
SharedMetricRegistries { public static MetricRegistry getOrCreate(String name) { final MetricRegistry existing = REGISTRIES.get(name); if (existing == null) { final MetricRegistry created = new MetricRegistryImpl(); final MetricRegistry raced = add(name, created); if (raced == null) { return created; } return raced; } return existing; } private  SharedMetricRegistries(); }
SharedMetricRegistries { public static MetricRegistry getOrCreate(String name) { final MetricRegistry existing = REGISTRIES.get(name); if (existing == null) { final MetricRegistry created = new MetricRegistryImpl(); final MetricRegistry raced = add(name, created); if (raced == null) { return created; } return raced; } return existing; } private  SharedMetricRegistries(); static void clear(); static Set<String> names(); static void remove(String key); static MetricRegistry add(String name, MetricRegistry registry); static MetricRegistry getOrCreate(String name); }
SharedMetricRegistries { public static MetricRegistry getOrCreate(String name) { final MetricRegistry existing = REGISTRIES.get(name); if (existing == null) { final MetricRegistry created = new MetricRegistryImpl(); final MetricRegistry raced = add(name, created); if (raced == null) { return created; } return raced; } return existing; } private  SharedMetricRegistries(); static void clear(); static Set<String> names(); static void remove(String key); static MetricRegistry add(String name, MetricRegistry registry); static MetricRegistry getOrCreate(String name);  }