|
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
|
package multiplethread; import java.util.concurrent.LinkedBlockingQueue;import java.util.concurrent.ThreadPoolExecutor;import java.util.concurrent.TimeUnit; public class TestThread { public static void main(String[] args) throws InterruptedException { ThreadPoolExecutor threadPool= new ThreadPoolExecutor(10, 15, 60, TimeUnit.SECONDS, newLinkedBlockingQueue<Runnable>()); threadPool.execute(new Runnable(){ @Override public void run() { // TODO Auto-generated method stub System.out.println("任务1"); } }); } } |
原文:https://www.cnblogs.com/chinaifae/p/10193780.html