java - ExecutorService不关闭会怎样?
PHP中文网
PHP中文网 2017-04-18 10:49:25
0
1
923

ExecutorService不关闭会怎样,或者怎么样保证web项目的公用线程池在项目结束时在关闭?

PHP中文网
PHP中文网

认证高级PHP讲师

reply all(1)
阿神

If you don’t actively close the thread pool, there will be some dormant threads in the pool, which will usually be shut down after 1 minute.
So if a thread pool is used in a web project, it is best to turn off the initialized thread pool in the ServletContextListener.destroy method, usually using shutdown()shutdownNow() ,如果做得完善些,可以再加上 awaitTermination such processing.

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template