First on the two picture, the left one is the concurrent under the package of all the interface, the right is all the classes under the package, in fact, we often use the interface and classes are a few, the next will be described in detail.
1. Common interfaces
Callable: A thread interface with a return value
Future: A generic interface used to receive the return value, providing an operation that cancle the terminating thread
Executor: Performer of specific runnable tasks
Executorservice: A thread pool manager that can dispatch runnable and callable tasks
Blockingqueue: Blocking queues
2. Common Classes
(1) Executors: The operation used to create the thread pool
Executors.newfixedthreadpool (n): Create a fixed-size thread pool
Executors.newcachedthreadpool (): Create a thread-free pool that automatically recycles and exploits idle (over 60s unused) threads
Executors.newsinglethreadexecutor (): a single background thread that ensures that individual tasks are executed in order, and that no multiple threads are active at the same time.
(2) Semaphore: A statistical semaphore used to limit the number of threads that can access certain resources.
Use the Acquire () function to consume a resource
Use the release () function to release a resource
Not to be continued ....
java--Multithreading Management (concurrent package)