In the utility library, I create an ExecutorService
ExecutorService es = Executors.newSingleThreadExecutor();
Then the main thread will send some jobs to this ExecutorService. When the main thread is complete, I would like to disable the ExecutorService so that the application can exit.
The problem is that I can only change the code in the library utility. One option that I have been considering is to use daemon threads. But then he will suddenly stop working before tasks sent to the service can be completed.
source
share