【并发】Java并发线程池底层原理详解与源码分析(上)
线程池与线程对比
我们先来看看下面这个例子,我们用一个小Demo,来演示多线程与线程池的运行情况
使用线程的方式运行
/**
* 使用线程的方式去执行程序
*/
public class ThreadTest {
public static void main(String[] args) throws InterruptedException {
Long start = System.currentTimeMillis();
final Random random = new Random();
final List<Integer> list = new ArrayList<Integer>();
for (int i = 0; i < 100000; i++