executorService = Executors.newScheduledThreadPool (1);
above , on one thread only, it is also necessary to use the thread pool , direct new thread and then start not enough , there is the difference? Seeking advice.
------ Solution ---------------------------------------- ----
Note that threads in the pool can be reused , and what new Thread , exhausted gone.
1 ex useful , only one thread can be restricted to work .
------ Solution ---------------------------------------- ----
create threads and destroying threads are the need of time. Performance is not high , read this article
------ For reference only ---------------------------------------
run in the thread pool it may still be safe , and if on a thread, then why open the thread it? In the main thread ran not?
没有评论:
发表评论