Added ThreadNameDeterminer.CURRENT and PROPOSED

This commit is contained in:
Trustin Lee 2009-09-04 02:22:28 +00:00
parent 8a0f8e9d78
commit 5345c7f509
2 changed files with 23 additions and 6 deletions

View File

@ -24,6 +24,28 @@ package org.jboss.netty.util;
*/
public interface ThreadNameDeterminer {
/**
* {@link ThreadNameDeterminer} that accepts the proposed thread name
* as is.
*/
ThreadNameDeterminer PROPOSED = new ThreadNameDeterminer() {
public String determineThreadName(String currentThreadName,
String proposedThreadName) throws Exception {
return proposedThreadName;
}
};
/**
* {@link ThreadNameDeterminer} that rejects the proposed thread name and
* retains the current one.
*/
ThreadNameDeterminer CURRENT = new ThreadNameDeterminer() {
public String determineThreadName(String currentThreadName,
String proposedThreadName) throws Exception {
return null;
}
};
/**
* Overrides the thread name proposed by {@link ThreadRenamingRunnable}.
*

View File

@ -38,12 +38,7 @@ public class ThreadRenamingRunnable implements Runnable {
InternalLoggerFactory.getInstance(ThreadRenamingRunnable.class);
private static volatile ThreadNameDeterminer threadNameDeterminer =
new ThreadNameDeterminer() {
public String determineThreadName(
String oldThreadName, String newThreadName) throws Exception {
return newThreadName;
}
};
ThreadNameDeterminer.PROPOSED;
/**
* Returns the {@link ThreadNameDeterminer} which overrides the proposed