in geronimo-metrics/src/main/java/org/apache/geronimo/microprofile/metrics/cdi/TimedInterceptor.java [74:101]
private Timer findTimer(final Executable executable) {
if (timers == null) {
synchronized (this) {
if (timers == null) {
timers = new ConcurrentHashMap<>();
}
}
}
Timer timer = timers.get(executable);
if (timer == null) {
final AnnotatedType<?> type = beanManager.createAnnotatedType(bean.getBeanClass());
final Timed timed = Stream.concat(type.getMethods().stream(), type.getConstructors().stream())
.filter(it -> it.getJavaMember().equals(executable))
.findFirst()
.map(m -> m.getAnnotation(Timed.class))
.orElse(null);
final String name = Names.findName(
Modifier.isAbstract(executable.getDeclaringClass().getModifiers()) ? type.getJavaClass() : executable.getDeclaringClass(),
executable, timed == null ? null : timed.name(), timed != null && timed.absolute(),
ofNullable(extension.getAnnotation(type, Timed.class)).map(Timed::name).orElse(""));
timer = registry.getTimer(new MetricID(name, extension.createTags(timed == null ? new String[0] : timed.tags())));
if (timer == null) {
throw new IllegalStateException("No timer with name [" + name + "] found in registry [" + registry + "]");
}
timers.putIfAbsent(executable, timer);
}
return timer;
}