Naming Netty IO threads

382 views
Skip to first unread message

nraych...@gmail.com

unread,
Feb 6, 2014, 12:19:05 PM2/6/14
to ne...@googlegroups.com

Hi,

I am using the following code in to create NioClientSocketFactory...

 new NioClientSocketChannelFactory(
            Executors.newCachedThreadPool(new NamedThreadFactory("My IO Boss")),
            Executors.newCachedThreadPool(new NamedThreadFactory("My IO Worker")))

But when I fire my profiler to check all the threads in my application I see them as New I/O worker #<some number>. I would assume the NioClientSocketChannelFactory will use the appropiate NamedThreadFactory to name the threads. Is there anything I am missing?

Thanks in advance

Nilanjan

Norman Maurer

unread,
Feb 6, 2014, 1:47:08 PM2/6/14
to ne...@googlegroups.com, nraych...@gmail.com
--
 
---
You received this message because you are subscribed to the Google Groups "Netty discussions" group.
To unsubscribe from this group and stop receiving emails from it, send an email to netty+un...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

Nilanjan Raychaudhuri

unread,
Feb 6, 2014, 4:57:52 PM2/6/14
to ne...@googlegroups.com, nraych...@gmail.com
Thanks for the quick response Norman. I did see that but I am not sure whether this fixes my problem. The reason I was looking for renaming my netty worker threads because in my app I have 3 different netty thread pool coming from 3 different libraries. The ThreadRenamingRunnable is static so anything I do would apply for all the netty pools. How can I differentiate between different pools?

I am curious why Netty is not using the name set by ThreadFactory?

Nilanjan

Norman Maurer

unread,
Feb 7, 2014, 12:59:36 AM2/7/14
to ne...@googlegroups.com, Nilanjan Raychaudhuri
You can also pass the ThreadNameDeterminer into NioWorkerPool / NioBossPool.

We now use the name set in ThreadFactory in Netty 4, but will not change in Netty 3 because of backward compatibility.

-- 
Norman Maurer

JBoss, by Red Hat


Reply all
Reply to author
Forward
0 new messages