以后写demo或者项目中用
public class Duoxiancheng {
private static ThreadPoolExecutor executor = new ThreadPoolExecutor(3, 6,
1000L, TimeUnit.MILLISECONDS,
new ArrayBlockingQueue<>(200));
public static void test1(){
for (int j = 0;j<10;j++){
executor.submit(()->{
for (int i = 0;i<1000;i++){
System.out.println("线程id:"+Thread.currentThread().getId());
}
});
}
//System.out.println("看看看看");
}
public static void main(String[] args) {
test1();
}
}