java 线程池

package demo06;

import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;

public class pooldemo {
    public static void main(String[] args) {
        ExecutorService es = Executors.newFixedThreadPool(2);
        es.submit(new Runnable() {
            @Override
            public void run() {
                System.out.println(Thread.currentThread().getName());
            }
        });

        es.submit(new Runnable() {
            @Override
            public void run() {
                System.out.println(Thread.currentThread().getName());
            }
        });

        es.submit(new Runnable() {
            @Override
            public void run() {
                System.out.println(Thread.currentThread().getName());
            }
        });
    }
}

 

posted @ 2019-02-14 22:21  Erick-LONG  阅读(153)  评论(0编辑  收藏  举报