public static <T> QueryRunner<T> safeBuild(
     QueryRunner<T> delegate,
     Function<Query<T>, ServiceMetricEvent.Builder> builderFn,
     ServiceEmitter emitter,
     AtomicLong accumulator,
     boolean report) {
   if (!VMUtils.isThreadCpuTimeEnabled()) {
     return delegate;
   } else {
     return new CPUTimeMetricQueryRunner<>(delegate, builderFn, emitter, accumulator, report);
   }
 }
 private CPUTimeMetricQueryRunner(
     QueryRunner<T> delegate,
     Function<Query<T>, ServiceMetricEvent.Builder> builderFn,
     ServiceEmitter emitter,
     AtomicLong cpuTimeAccumulator,
     boolean report) {
   if (!VMUtils.isThreadCpuTimeEnabled()) {
     throw new ISE("Cpu time must enabled");
   }
   this.delegate = delegate;
   this.builderFn = builderFn;
   this.emitter = emitter;
   this.cpuTimeAccumulator = cpuTimeAccumulator == null ? new AtomicLong(0L) : cpuTimeAccumulator;
   this.report = report;
 }