/**
* 并发量
*/
private static final Integer N_THREADS = 100;
public static void main(String[] args) throws InterruptedException {
//线程池,参数为最大并发量,其余进入线程等待
ExecutorService cachedThreadPool = Executors.newFixedThreadPool(N_THREADS);
for (int i = 0; i < N_THREADS; i++) {
final int index = i;
cachedThreadPool.execute(new Runnable() {
public void run() {
try {
} catch (Exception e) {
e.printStackTrace();
}
}
});
}
}