ExecutorService executorService = Executors.newFixedThreadPool(10);
A thread pool should be created by ThreadPoolExecutors rather than Executors.
These would be make note: Below are the problems created by usage of Executors
for thread pool execution:
1)FixedThreadPool and SingleThreadPool:
Maximum request queue size Integer.MAX_VAULE. A large number of requests might cause OOM.
2) CachedThreadPool:
The number of threads which are allowed to be created is Integer.MAX_VALUE。
Creating too many threads might lead to OOM.