线程池ThreadPoolExcutor
/*
* interface Executor 執(zhí)行行程接口
* +executor(Runnable object)執(zhí)行任務(wù)
* interface ExecutorService 管理線程接口
* +shutdown()關(guān)閉執(zhí)行器
* +shutdownNow()立即關(guān)閉執(zhí)行器,返回未完成任務(wù)清單
* +isShutdown執(zhí)行器已關(guān)閉返回true
* +isTerminated想線程池中所有任務(wù)都被終結(jié),返回true
*
* Executors類的靜態(tài)方法
* +newFixedThreadPool(numberOfThreads:int):ExecutorService 創(chuàng)建一個(gè)固定線程數(shù)量的線程池,并行執(zhí)行的線程數(shù)量不變,線程當(dāng)前任務(wù)完成后,可以被重用執(zhí)行另一個(gè)任務(wù)
* +newCachedThreadPool():ExecutorService 創(chuàng)建一個(gè)線程池,按需創(chuàng)建新線程,但當(dāng)前面創(chuàng)建的線程可用時(shí),則重用它們
*/
總結(jié)
以上是生活随笔為你收集整理的线程池ThreadPoolExcutor的全部?jī)?nèi)容,希望文章能夠幫你解決所遇到的問(wèn)題。
- 上一篇: Java改进的冒泡排序ImprovedB
- 下一篇: 使用javabean类用户注册