站点更新:2020-02-13 12:30:00
This commit is contained in:
Binary file not shown.
@@ -4,8 +4,10 @@ import java.util.concurrent.ExecutorService;
|
|||||||
import java.util.concurrent.Executors;
|
import java.util.concurrent.Executors;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Created by lixiangrong on 2016/12/22.
|
* @author lixiangrong
|
||||||
|
* @date 2016/12/22
|
||||||
*/
|
*/
|
||||||
|
//@SuppressWarnings({"AlibabaRemoveCommentedCode", "Convert2Lambda", "UnnecessaryLocalVariable"})
|
||||||
public class ThreadPoolExecutorTest {
|
public class ThreadPoolExecutorTest {
|
||||||
public static void main(String[] args) {
|
public static void main(String[] args) {
|
||||||
ExecutorService cachedThreadPool = Executors.newCachedThreadPool();
|
ExecutorService cachedThreadPool = Executors.newCachedThreadPool();
|
||||||
@@ -16,10 +18,11 @@ public class ThreadPoolExecutorTest {
|
|||||||
//} catch (InterruptedException e) {
|
//} catch (InterruptedException e) {
|
||||||
// e.printStackTrace();
|
// e.printStackTrace();
|
||||||
//}
|
//}
|
||||||
cachedThreadPool.execute (new Runnable() {
|
cachedThreadPool.execute(new Runnable() {
|
||||||
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
//System.out.println(index);
|
//System.out.println(index);
|
||||||
System.out.println("Thread: "+Thread.currentThread().getName());
|
System.out.println("Thread: " + Thread.currentThread().getName());
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user