public static <R, T extends Throwable> R trace(final ThrowingCallable<R, T> callable,
    final Supplier<Span> spanSupplier) throws T {
    Span span = spanSupplier.get();
    try (Scope ignored = span.makeCurrent()) {
      final R ret = callable.call();
      span.setStatus(StatusCode.OK);
      return ret;
    } catch (Throwable e) {
      setError(span, e);
      throw e;
    } finally {
      span.end();
    }
  }
A {@link Callable} that may also throw.
@param <R> the result type of method call.
@param <T> the type of {@link Throwable} that can be produced.
hbase-common/src/main/java/org/apache/hadoop/hbase/trace/TraceUtil.java