I would like to set name for threads of the ForkJoinPool used by work stealing pool, supplied by
ExecutorService newWorkStealingPool(int parallelism)
or
ExecutorService newWorkStealingPool()
So far I could not find a way to set custom names on threads used by this ExecutorService
, is there a way?
newWorkStealingPool()
basically supplies a ForkJoinPool
, but ForkJoinPool
also doesn't have a public constructor with supplied name pattern.
update:
I have now found this constructor of
ForkJoinPool
which takes a thread factory ForkJoinPool.ForkJoinWorkerThreadFactory
. But factory should return a ForkJoinWorkerThread
, which doesn't have a public constructor. So I guess I will have to subclass ForkJoinWorkerThread
.