Does Executors.newSingleThreadExecutor service needs a cleanup using shutdown?

Viewed 3530

I have one slight confusion regarding clean up of executor service using newSingleThreadExecutor. As per its implementation, it internally creates a thread pool of one thread and in case of failure a new one will be created. And I am using singleThreadExecutor as I want to sequentially run the tasks created at runtime. So my concern is do I need to shutdown this executor service, when there are no more tasks in the system?

I have read that the active threads inside the ExecutorService prevents the JVM from shutting down. Since singleThreadExecutor also creates a thread pool inside, so does that mean that the thread is active or not?

Sorry if there is already question about it.

1 Answers
Related