使用Java的ThreadPoolExecutor可以并发地执行一些任务,它的基本用法是:
(1)创建一个 ThreadPoolExecutor 对象
ThreadPoolExecutor executor = new ThreadPoolExecutor(corePoolSize, maximumPoolSize, keepAliveTime, TimeUnit.MILLISECONDS, new LinkedBlockingQueue<Runnable>(workQueueSize));