@Override public <T> void hear(TypeLiteral<T> literal, TypeEncounter<T> encounter) { Class<? super T> klass = literal.getRawType(); for (Method method : klass.getDeclaredMethods()) { if (method.isSynthetic()) { continue; } final MethodInterceptor interceptor = getInterceptor(method); if (interceptor != null) { encounter.bindInterceptor(Matchers.only(method), interceptor); } } }
@Override public <T> void hear(TypeLiteral<T> literal, TypeEncounter<T> encounter) { Class<? super T> klass = literal.getRawType(); for (Method method : klass.getDeclaredMethods()) { if (method.isSynthetic()) { continue; } final MethodInterceptor interceptor = getInterceptor(method); if (interceptor != null) { encounter.bindInterceptor(Matchers.only(method), interceptor); } } }
@Override public <T> void hear(TypeLiteral<T> literal, TypeEncounter<T> encounter) { final Class<? super T> klass = literal.getRawType(); for (Method method : klass.getDeclaredMethods()) { final MethodInterceptor interceptor = MeteredInterceptor.forMethod(metricsRegistry, klass, method); if (interceptor != null) { encounter.bindInterceptor(Matchers.only(method), interceptor); } } } }
@Override public <T> void hear(TypeLiteral<T> literal, TypeEncounter<T> encounter) { final Class<? super T> klass = literal.getRawType(); for (Method method : klass.getDeclaredMethods()) { final MethodInterceptor interceptor = TimedInterceptor.forMethod(metricsRegistry, klass, method); if (interceptor != null) { encounter.bindInterceptor(Matchers.only(method), interceptor); } } } }
@Override public <T> void hear(TypeLiteral<T> literal, TypeEncounter<T> encounter) { final Class<?> klass = literal.getRawType(); for (Method method : klass.getDeclaredMethods()) { final MethodInterceptor interceptor = ExceptionMeteredInterceptor.forMethod( metricsRegistry, klass, method); if (interceptor != null) { encounter.bindInterceptor(Matchers.only(method), interceptor); } } } }
final Timer timer = _metricRegistry.timer(metric); encounter.bindInterceptor(Matchers.only(method), new MethodInterceptor() { @Override public Object invoke(MethodInvocation invocation) throws Throwable {
final Timer timer = _metricRegistry.timer(metric); encounter.bindInterceptor(Matchers.only(method), new MethodInterceptor() { @Override public Object invoke(MethodInvocation invocation) throws Throwable {
@Override public <T> void hear(TypeLiteral<T> literal, TypeEncounter<T> encounter) { for (Method method : literal.getRawType().getMethods()) { final TimedResource annotation = method.getAnnotation(TimedResource.class); if (annotation != null) { final String name = annotation.name().isEmpty() ? method.getName() : annotation.name(); final TimedResourceMetric timer = new TimedResourceMetric(metricsRegistryFuture, literal.getRawType(), name, annotation.defaultStatusCode(), annotation.durationUnit(), annotation.rateUnit()); encounter.bindInterceptor(Matchers.only(method), new TimedResourceInterceptor(timer)); } } } }