public static void seriesTimeThen(Object uniqueKey, Runnable r, BiConsumer<Long, Long> then) {
    Stopwatch total = CacheUtil.cache(TimingUtil.class, uniqueKey, () -> Stopwatch.createUnstarted());
    Stopwatch temp = getShareStopwatch();
    temp.reset();
    temp.start();
    total.start();
    r.run();
    temp.stop();
    total.stop();
    if (then != null) {
      then.accept(temp.elapsed(TimeUnit.MILLISECONDS), total.elapsed(TimeUnit.MILLISECONDS));
    }
  }
public static void seriesTimeThen ( Object uniqueKey , Runnable r , BiConsumer < Long , Long > then ) { Stopwatch total = CacheUtil . cache ( TimingUtil . class , uniqueKey , ( ) -> Stopwatch . createUnstarted ( ) ) ; Stopwatch temp = getShareStopwatch ( ) ; temp . reset ( ) ; temp . start ( ) ; total . start ( ) ; r . run ( ) ; temp . stop ( ) ; total . stop ( ) ; if ( then != null ) { then . accept ( temp . elapsed ( TimeUnit . MILLISECONDS ) , total . elapsed ( TimeUnit . MILLISECONDS ) ) ; } }
@param uniqueKey unique key
@param r the task
@param then (this time, total time) -&#62; {...}