当前位置:   article > 正文

线程池(3)Executors.newCachedThreadPool

executors.newcachedthreadpool

例子:

ExecutorService es = Executors.newCachedThreadPool();
        try {
            for (int i = 0; i < 20; i++) {
                Runnable syncRunnable = new Runnable() {
                    @Override
                    public void run() {
                        log.info(Thread.currentThread().getName());
                        try {
                            Thread.sleep(2000
声明:本文内容由网友自发贡献,转载请注明出处:【wpsshop】
推荐阅读
相关标签
  

闽ICP备14008679号