org.jboss.netty.util
类 ThreadRenamingRunnable

java.lang.Object
  继承者 org.jboss.netty.util.ThreadRenamingRunnable
所有已实现的接口:
java.lang.Runnable

public class ThreadRenamingRunnable
extends java.lang.Object
implements java.lang.Runnable

一个用于改变当前线程名称并在它执行结束后重新设置回原来名称的Runnable.要使用Netty修改默认线程名称,请使用 setThreadNameDeterminer(ThreadNameDeterminer).


构造方法摘要
ThreadRenamingRunnable(java.lang.Runnable runnable, java.lang.String proposedThreadName)
          创建一个包装指定runnable并当指定的runnable正在运行时使用指定的线程名称代替原名称 Creates a new instance which wraps the specified runnable and changes the thread name to the specified thread name when the specified runnable is running.
 
方法摘要
static ThreadNameDeterminer getThreadNameDeterminer()
          返回一个用于重写建议线程名称的ThreadNameDeterminer.
 void run()
           
static void setThreadNameDeterminer(ThreadNameDeterminer threadNameDeterminer)
          设置一个用于重写建议 Sets the ThreadNameDeterminer which overrides the proposed new thread name.
 
从类 java.lang.Object 继承的方法
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

构造方法详细信息

ThreadRenamingRunnable

public ThreadRenamingRunnable(java.lang.Runnable runnable,
                              java.lang.String proposedThreadName)
创建一个包装指定runnable并当指定的runnable正在运行时使用指定的线程名称代替原名称 Creates a new instance which wraps the specified runnable and changes the thread name to the specified thread name when the specified runnable is running.

方法详细信息

getThreadNameDeterminer

public static ThreadNameDeterminer getThreadNameDeterminer()
返回一个用于重写建议线程名称的ThreadNameDeterminer.


setThreadNameDeterminer

public static void setThreadNameDeterminer(ThreadNameDeterminer threadNameDeterminer)
设置一个用于重写建议 Sets the ThreadNameDeterminer which overrides the proposed new thread name. Please note that the specified ThreadNameDeterminer affects only new ThreadRenamingRunnables; the existing instances are not affected at all. Therefore, you should make sure to call this method at the earliest possible point (i.e. before any Netty worker thread starts) for consistent thread naming. Otherwise, you might see the default thread names and the new names appear at the same time in the full thread dump.


run

public void run()
指定者:
接口 java.lang.Runnable 中的 run