首页 > 编程语言 > 详细

线程工具类ThreadUtils

时间:2018-02-04 13:19:19      阅读:451      评论:0      收藏:0      [点我收藏+]

package yqw.java.util;

 

public class ThreadUtils {

    /**
     * showThreadInfo
     *
     * @return
     */
    public static final String showThreadInfo() {

        return "^^^^^^^^^^^^^^^^^^^^^^^ currentThread: name=" + Thread.currentThread().getName() + "  , id="
                + Thread.currentThread().getId() +

        "   ,state=" + Thread.currentThread().getState() + "   , Priority=" + Thread.currentThread().getPriority();
    }

    /**
     * sleep not catch Exception
     *
     * @param ms
     * @return
     */
    public static boolean sleep(int ms) {
        try {
            Thread.sleep(ms);
            return true;
        } catch (InterruptedException e) {
            return false;
        }
    }
}

线程工具类ThreadUtils

原文:https://www.cnblogs.com/yang75n/p/8412963.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!