Java.util.concurrent Bag
interface and related class inheritance relationship:
Executor
|-executorservice <-Threadpoolexecutor
|-scheduledexecutorservice <-Scheduledthreadpoolexecutor
Because the Threadpoolexecutor and scheduledthreadpoolexecutor constructors are too complex, they are set by default using the class executors
There are five factory methods inside the executors that generate the thread pool (the default settings for Threadpoolexecutor and Scheduledthreadpoolexecutor parameters are set internally by the method):
1. Newcachedthreadpool ()
No boundary pool: Creates a new thread when there is a task, and the idle thread retains 60s auto-recycle
2. Newfixedthreadpool ()
Fixed size thread pool: Idle hold, wait if task exceeds thread pool size
3. Newsinglethreadexecutor ()
There is only one worker thread, which executes the task sequentially
4. Newscheduledthreadpool ()
A single worker thread that schedules tasks on a time basis
5. Newsinglescheduledexecutor ()
thread pool for tasks by time schedule (timing, cycle Task)
Java thread pool