runtime.getruntime.availableprocessors

1:获取cpu核心数: Runtime.getRuntime().availableProcessors(); 

创建线程池: Executors.newFixedThreadPool(nThreads);//nThreads为线程数2:

posted @ 2017-07-25 15:51  郝二驴  阅读(4787)  评论(0编辑  收藏  举报