I would like to set a name for the ForkJoinPool threads used by the work processing pool provided by
ExecutorService newWorkStealingPool(int parallelism)
or
ExecutorService newWorkStealingPool()
Until now, I could not find a way to set user names in the threads used by this ExecutorService, is there any way?
newWorkStealingPool()basically provides ForkJoinPool, but ForkJoinPoolalso does not have an open constructor with the specified name pattern.
Update : I found this constructor
ForkJoinPoolthat accepts a factory thread ForkJoinPool.ForkJoinWorkerThreadFactory. But the factory should return ForkJoinWorkerThreadthat does not have a common constructor. Therefore, I assume that I will have to subclass ForkJoinWorkerThread.
source
share