Code example for LoadingCache

Methods: get

0
  public Object invoke(MethodInvocation methodInvocation) throws Throwable {
    Method method = methodInvocation.getMethod();
    Timed timed = method.getAnnotation(Timed.class);
    String name = timed.value();
    if (name.isEmpty()) {
      name = nameCache.get(methodInvocation.getMethod());
    } 
    Timer timer; 
    if (timed.isRequest()) {
      timer = Timing.startRequest(name, timed.threshold());
    } else { 
      timer = Timing.start(name, timed.threshold());
    } 
    try { 
      return methodInvocation.proceed();
    } finally { 
      Timing.stop(timer); 
    } 
  } 
}