Executor’s newFixedThreadPool factory method :
Syntax:
Java newFixedThreadPool example:
Starting LoopTask 3
Starting LoopTask 2
Executing LoopTask 3 with pool-1-thread-3====1
Executing LoopTask 1 with pool-1-thread-1====1
Executing LoopTask 3 with pool-1-thread-3====2
Executing LoopTask 2 with pool-1-thread-2====1
Executing LoopTask 3 with pool-1-thread-3====3
Executing LoopTask 1 with pool-1-thread-1====2
Executing LoopTask 3 with pool-1-thread-3====4
Executing LoopTask 2 with pool-1-thread-2====2
Executing LoopTask 3 with pool-1-thread-3====5
Executing LoopTask 3 with pool-1-thread-3====6
Executing LoopTask 1 with pool-1-thread-1====3
Executing LoopTask 3 with pool-1-thread-3====7
Executing LoopTask 2 with pool-1-thread-2====3
Executing LoopTask 3 with pool-1-thread-3====8
Executing LoopTask 1 with pool-1-thread-1====4
Executing LoopTask 3 with pool-1-thread-3====9
Executing LoopTask 2 with pool-1-thread-2====4
Executing LoopTask 3 with pool-1-thread-3====10
Executing LoopTask 1 with pool-1-thread-1====5
Executing LoopTask 1 with pool-1-thread-1====6
Ending LoopTask 3
Executing LoopTask 2 with pool-1-thread-2====5
Executing LoopTask 2 with pool-1-thread-2====6
Executing LoopTask 2 with pool-1-thread-2====7
Executing LoopTask 2 with pool-1-thread-2====8
Executing LoopTask 2 with pool-1-thread-2====9
Executing LoopTask 1 with pool-1-thread-1====7
Executing LoopTask 2 with pool-1-thread-2====10
Starting LoopTask 4
Ending LoopTask 2
Executing LoopTask 1 with pool-1-thread-1====8
Starting LoopTask 5
Executing LoopTask 4 with pool-1-thread-3====1
Executing LoopTask 5 with pool-1-thread-2====1
Executing LoopTask 1 with pool-1-thread-1====9
Executing LoopTask 1 with pool-1-thread-1====10
Ending LoopTask 1
Executing LoopTask 5 with pool-1-thread-2====2
Executing LoopTask 4 with pool-1-thread-3====2
Executing LoopTask 4 with pool-1-thread-3====3
Executing LoopTask 5 with pool-1-thread-2====3
Starting LoopTask 6
Executing LoopTask 5 with pool-1-thread-2====4
Executing LoopTask 4 with pool-1-thread-3====4
Executing LoopTask 5 with pool-1-thread-2====5
Executing LoopTask 5 with pool-1-thread-2====6
Executing LoopTask 6 with pool-1-thread-1====1
Executing LoopTask 6 with pool-1-thread-1====2
Executing LoopTask 6 with pool-1-thread-1====3
Executing LoopTask 6 with pool-1-thread-1====4
Executing LoopTask 5 with pool-1-thread-2====7
Executing LoopTask 4 with pool-1-thread-3====5
Executing LoopTask 4 with pool-1-thread-3====6
Executing LoopTask 4 with pool-1-thread-3====7
Executing LoopTask 4 with pool-1-thread-3====8
Executing LoopTask 5 with pool-1-thread-2====8
Executing LoopTask 6 with pool-1-thread-1====5
Executing LoopTask 5 with pool-1-thread-2====9
Executing LoopTask 4 with pool-1-thread-3====9
Executing LoopTask 4 with pool-1-thread-3====10
Executing LoopTask 5 with pool-1-thread-2====10
Ending LoopTask 5
Executing LoopTask 6 with pool-1-thread-1====6
Ending LoopTask 4
Executing LoopTask 6 with pool-1-thread-1====7
Executing LoopTask 6 with pool-1-thread-1====8
Executing LoopTask 6 with pool-1-thread-1====9
Executing LoopTask 6 with pool-1-thread-1====10
Ending LoopTask 6