package com.Java;

import java.util.concurrent.*;

public class TestPool {
public static void main(String[] args) {
//创建服务 创建线程池
ExecutorService service = Executors.newFixedThreadPool(3);

service.submit(new MyPoll());
service.submit(new MyPoll());
service.submit(new MyPoll());
//关闭服务
service.shutdownNow();

}
}
class MyPoll implements Callable {
@Override
public Object call() {
System.out.println(Thread.currentThread().getName());
return 1+2;
}
}