use of com.sun.jersey.spi.dispatch.RequestDispatcher in project metrics by dropwizard.
the class InstrumentedResourceMethodDispatchProvider method create.
@Override
public RequestDispatcher create(AbstractResourceMethod method) {
RequestDispatcher dispatcher = provider.create(method);
if (dispatcher == null) {
return null;
}
if (method.getMethod().isAnnotationPresent(Timed.class)) {
final Timed annotation = method.getMethod().getAnnotation(Timed.class);
final String name = chooseName(annotation.name(), annotation.absolute(), method);
final Timer timer = registry.timer(name);
dispatcher = new TimedRequestDispatcher(dispatcher, timer);
}
if (method.getMethod().isAnnotationPresent(Metered.class)) {
final Metered annotation = method.getMethod().getAnnotation(Metered.class);
final String name = chooseName(annotation.name(), annotation.absolute(), method);
final Meter meter = registry.meter(name);
dispatcher = new MeteredRequestDispatcher(dispatcher, meter);
}
if (method.getMethod().isAnnotationPresent(ExceptionMetered.class)) {
final ExceptionMetered annotation = method.getMethod().getAnnotation(ExceptionMetered.class);
final String name = chooseName(annotation.name(), annotation.absolute(), method, ExceptionMetered.DEFAULT_NAME_SUFFIX);
final Meter meter = registry.meter(name);
dispatcher = new ExceptionMeteredRequestDispatcher(dispatcher, meter, annotation.cause());
}
return dispatcher;
}
Aggregations