@Override
  public Object invoke(Object proxy, Method m, Object[] args) throws Throwable {
    Object result;
    long start = now();
    try {
      result = m.invoke(handler, args);
    } catch (InvocationTargetException e) {
      metrics.exception(e.getCause());
      throw e.getTargetException();
    } catch (Exception e) {
      metrics.exception(e);
      throw new RuntimeException("unexpected invocation exception: " + e.getMessage());
    } finally {
      long processTime = now() - start;
      metrics.incMethodTime(m.getName(), processTime);
    }
    return result;
  }
Converts a Hbase.Iface using InvocationHandler so that it reports process time of each call to
ThriftMetrics.
hbase-thrift/src/main/java/org/apache/hadoop/hbase/thrift/HbaseHandlerMetricsProxy.java