接下来,对于另一个线程池类DatamineThread,几乎复制了完全相同的结构。
Next, you almost copy the exact same structure for the next thread pool class, DatamineThread.
分析这段代码时您可以看到,我们添加了另一个队列实例,然后将该队列传递给第一个线程池类ThreadURL。
In looking at the code, you can see that we added another instance of a queue, and then passed that queue into the first thread pool class, ThreadURL.
如果您发现您的应用程序需要线程池,那么请考虑使用ut il . concurrent中的某个executor类,例如PooledExecutor,而不用从头开始编写。
If you find yourself in need of a thread pool for your application, consider using one of the Executor classes from util.concurrent, such as PooledExecutor, rather than writing one from scratch.
应用推荐