Can I restart an ExecutorService to start accepting new task after it has been shutdown?
Or I have to always create new ExecutorService instance?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
If you look at the documentation, there is no method to restart an
ExecutorService, as it is an interface without such a method you can infer that there is no way to restart it. That said, asExecutorServiceis an interface, you could conceivably write an implementation that does restart (but you would have to reference it by its concrete type or another interface). I wouldn’t recommend it though. Just use the existing ones and recreate them as necessary.