Java – executorservice restart

Can I restart executorservice to start accepting new tasks after shutdown?

Or must I always create a new executorservice instance?

Solution

If you view the documentation, there is no method to restart executorservice, because it is an interface without this method, you can infer that it cannot be restarted In other words, since executorservice is an interface, you can imagine writing a restart implementation (but you must refer to it through its specific type or other interfaces) I wouldn't recommend it Just use the existing and recreate them as needed

The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
分享
二维码
< <上一篇
下一篇>>