[concurrency-interest] How to set the thread group of the ForkJoinPool?

Romain Colle rco at quartetfs.com
Wed Mar 7 14:40:55 EST 2012

On Wed, Mar 7, 2012 at 2:28 PM, Sébastien Bocq <sebastien.bocq at gmail.com>wrote:

> I use different pools and I need to identify from which pool threads
> are coming from. For instance, I want to use my own naming scheme.

Hi Sebastien,

We are using a thread factory to do so, and extend ForkJoinWorkerThread.
We simply call "setName" when the thread starts to get the required naming.
See sample code below.

    protected class Worker extends ForkJoinWorkerThread {
        protected Worker(ForkJoinPool pool) {

         * Called when the thread is started
        protected void onStart() {
            setName(poolName + "-" + poolIndex + "-worker-" +

Romain Colle
Senior R&D Engineer
2 rue Jean Lantier, 75001 Paris, France
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://cs.oswego.edu/pipermail/concurrency-interest/attachments/20120307/8a2b9aa6/attachment.html>

More information about the Concurrency-interest mailing list