Java 8 Parallel Streams Internals (Part 4)

preview_player
Показать описание
This video explains several ways to configure the number of threads used by parallel streams in Java 8.
Рекомендации по теме
Комментарии
Автор

Prof Doug, On a single core machine, what would be the # threads in ForkJoinPool? I think in that case only main Thread will be part of Fork-Join Pool or does it always create a thread in that case(thread per task)?
Regards,
Sanjeev

SanjeevKumar-hjfb
Автор

Respected Prof Doug,
I was trying to understand the ManagedLocker implementation. Instead of using ReentrantLock directly, the caller has to call APIs on the wrapper ManagedLocker. Does that mean that if the lock is not available, the thread will block and a new thread will be created in Fork-joinPool to compensate for the blocking thread. That means ManagedLocker will be useful only when the pool being used is ForkJoinPool.

Can we use ManagedLocker in other threadPools?

Regards,
Sanjeev

SanjeevKumar-hjfb