May
21
Java ForkJoin Pool CheatSheet
Java ForkJoin Pool
# Java ForkJoin Pool
1. As it sounds, assist distribute work
2. From java 7
3. Based on Doug Lea's work
4. As it sounds, break to simpler tasks
1. Ideally, no worker thread idle
1. Threads steal work
5. Classes you use
1. ForkJoinPool
1. Implements ExecutorService
2. `ForkJoinPool = new ForkJoinPool(int parallelism)`
1. With no arg by default, numProcessors
3. Pool adjusts its size! (though you specified number)
1. Send ForkJoinPool Tasks with
1. Execute() - asynchronous
2. invoke() - sync awaits
3. submit() - Async get Future
2. ForkJoinTask
1. isDone() - true when complete
2. isCompletedNormally() - finished without exception
3. isCompletedAbnormally() - true cancelled / exception
6. How to use
1.
# Java ForkJoin Pool
1. As it sounds, assist distribute work
2. From java 7
3. Based on Doug Lea's work
4. As it sounds, break to simpler tasks
1. Ideally, no worker thread idle
1. Threads steal work
5. Classes you use
1. ForkJoinPool
1. Implements ExecutorService
2. `ForkJoinPool = new ForkJoinPool(int parallelism)`
1. With no arg by default, numProcessors
3. Pool adjusts its size! (though you specified number)
1. Send ForkJoinPool Tasks with
1. Execute() - asynchronous
2. invoke() - sync awaits
3. submit() - Async get Future
2. ForkJoinTask
1. isDone() - true when complete
2. isCompletedNormally() - finished without exception
3. isCompletedAbnormally() - true cancelled / exception
6. How to use
1.