線程池調用

ThreadPoolManager threadPoolManager = ThreadPoolManager.newInstance();
if (list.size() > 0) {
    for (int i = 0; i < list.size(); i++) {
        threadPoolManager.addExecuteTask(new ThreadTask(i,list.get(i)));
        System.out.println("線程池中線程數目:" + threadPoolManager.getPoolSize() + ",隊列中等待執行的任務數目:"
                + threadPoolManager.getQueue() + ",已執行玩別的任務數目:" + threadPoolManager.getCompletedTaskCount());
    }
}
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章