Java Executor newWorkStealingPool() MethodThe newWorkStealingPool() method of Executors class creates a work-stealing thread pool using the number of available processors as its target parallelism level. SyntaxParameterparallelism - the targeted parallelism level Returnsthe newly created thread pool ThrowIllegalArgumentException Example 1Test it NowOutput: size of mypool: 0 Thread Name: ForkJoinPool-1-worker-5 after sleep Thread Name: ForkJoinPool-1-worker-5 Thread Name: ForkJoinPool-1-worker-3 after sleep Thread Name: ForkJoinPool-1-worker-3 Total number threads scheduled): 0 Example 1Test it NowOutput: size of mypool: 0 Thread Name: ForkJoinPool-1-worker-5 after sleep Thread Name: ForkJoinPool-1-worker-5 Thread Name: ForkJoinPool-1-worker-3 after sleep Thread Name: ForkJoinPool-1-worker-3 Total number threads scheduled): 0 Next TopicJava Executors |
We provides tutorials and interview questions of all technology like java tutorial, android, java frameworks
G-13, 2nd Floor, Sec-3, Noida, UP, 201301, India