美文网首页
Guava之StopWatch

Guava之StopWatch

作者: 神豪VS勇士赢 | 来源:发表于2020-08-24 01:55 被阅读0次
        private static void process(String orderNo) throws InterruptedException {
    
            LOGGER.info("start process the order [{}]", orderNo);
            Stopwatch stopwatch = Stopwatch.createStarted();
            TimeUnit.MILLISECONDS.sleep(100);
    
            LOGGER.info("The orderNo [{}] process successful and elapsed [{}] min.", orderNo, stopwatch.stop().elapsed(TimeUnit.MINUTES));
    
            /**
             * stopwatch.reset() 继续使用
             */
        }
    

    查看 StopWatch 源码 底层有用到ServiceLoader

    相关文章

      网友评论

          本文标题:Guava之StopWatch

          本文链接:https://www.haomeiwen.com/subject/kmrgjktx.html