Added ThreadNameDeterminer.CURRENT and PROPOSED
This commit is contained in:
parent
8a0f8e9d78
commit
5345c7f509
@ -24,6 +24,28 @@ package org.jboss.netty.util;
|
|||||||
*/
|
*/
|
||||||
public interface ThreadNameDeterminer {
|
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}.
|
* Overrides the thread name proposed by {@link ThreadRenamingRunnable}.
|
||||||
*
|
*
|
||||||
|
@ -38,12 +38,7 @@ public class ThreadRenamingRunnable implements Runnable {
|
|||||||
InternalLoggerFactory.getInstance(ThreadRenamingRunnable.class);
|
InternalLoggerFactory.getInstance(ThreadRenamingRunnable.class);
|
||||||
|
|
||||||
private static volatile ThreadNameDeterminer threadNameDeterminer =
|
private static volatile ThreadNameDeterminer threadNameDeterminer =
|
||||||
new ThreadNameDeterminer() {
|
ThreadNameDeterminer.PROPOSED;
|
||||||
public String determineThreadName(
|
|
||||||
String oldThreadName, String newThreadName) throws Exception {
|
|
||||||
return newThreadName;
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the {@link ThreadNameDeterminer} which overrides the proposed
|
* Returns the {@link ThreadNameDeterminer} which overrides the proposed
|
||||||
|
Loading…
Reference in New Issue
Block a user