[size=1em][backcolor=rgb(248, 248, 248) !important]查看源码[size=1em]
打印?
[size=1em][size=1em]
| <span style="font-size:12px;"> ExecutorService threadPool = Executors.newFixedThreadPool(3); |
[size=1em]
| for(int i=1; i<=10; i++){ |
[size=1em]
[size=1em]
| threadPool.execute(new Runnable(){ |
[size=1em]
[size=1em]
[size=1em]
| for(int i=1; i<=10; i++){ |
[size=1em]
| System.out.println(Thread.currentThread().getName() + " is looping of " + i + " the task is " + taskId); |
[size=1em]
[size=1em]
[size=1em]
| } catch (InterruptedException e) { |
[size=1em]
| // TODO Auto-generated catch block |
[size=1em]
[size=1em]
[size=1em]
[size=1em]
[size=1em]
[size=1em]
[size=1em]
[size=1em]
[size=1em]
| System.out.println("add all of 10 task"); |
[size=1em]
这个线程池里面是怎么在创建线程,线程执行完了之后会销毁吗?希望越详细越好