ThreadRenamingRunnable

jasons2645 jstevens at pillardata.com
Thu Jun 4 18:09:36 EDT 2009


I am running into a similar issue where it would be nice to have control over
thread names.  A suggestion for solving this...

Since ThreadRenamingRunnable is a public class, it seems like a good way to
provide this customization would be to introduce an interface named
something like ThreadNameDeterminer which would have a single method: String
determineThreadName( String originalThreadName, String
nettyProposedThreadName );  

DefaultThreadNameDeterminer could be installed by default on
ThreadRenamingRunnable, and modified by a client via a static setter method. 
DefaultThreadNameDeterminer would just return the netty-proposed thread
name.  

This would give users the flexibility to do whatever they want wrt thread
naming while providing good default behavior; it also eliminates the need to
try to 'find out' if the user has set a thread name themselves.

>>> However, I agree with you that it would be nice if 'New I/O
>>> (client|server) (boss|worker)' could be customizable.  Perhaps
>>> ThreadRenamingRunnable could be improved so that it does not rename
>>> the current thread completely but append additional information to the
>>> current thread name if a user set the thread name already?
>>
>> Hmm.. but how do I determine 'if a user set the thread name already?'
>> That's a tricky problem..
-- 
View this message in context: http://n2.nabble.com/ThreadRenamingRunnable-tp2650084p3027432.html
Sent from the Netty User Group mailing list archive at Nabble.com.





More information about the netty-users mailing list