FeignOutboundMetricsDecorator.java 文件源码

java
阅读 32 收藏 0 点赞 0 评论 0

项目:metrics-feign 作者:
@Override
public Object invoke(Object[] argv) throws Throwable {
    try {

        final Meter meter = this.meters.get(method);
        if (meter != null) {
            meter.mark();
        }

        final Timer timer = this.timers.get(method);
        if (timer != null) {
            this.context = timer.time();
        }

        return methodHandler.invoke(argv);

    } catch (Exception e) {

        final FeignOutboundMetricsDecorator.ExceptionMeterMetric metric =
                (method != null) ? this.exceptionMeters.get(method) : null;

        if (metric != null && (metric.cause.isAssignableFrom(e.getClass()) || (e.getCause() != null
                && metric.cause.isAssignableFrom(e.getCause().getClass())))) {
            metric.meter.mark();
        }

        throw e;
    } finally {
        if (this.context != null) {
            this.context.close();
        }
    }
}
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号