com.google.common.util.concurrent
Class NamingThreadFactory
java.lang.Object
  
com.google.common.util.concurrent.NamingThreadFactory
- All Implemented Interfaces: 
 - ThreadFactory
 
public class NamingThreadFactory
- extends Object
- implements ThreadFactory
  
A ThreadFactory which decorates another ThreadFactory to set a name on
 each thread created.
- Since:
 
  - 2009.09.15 tentative
 
- Author:
 
  - Kevin Bourrillion
 
 
| 
Constructor Summary | 
NamingThreadFactory(String format)
 
          Creates a new factory that delegates to the default thread factory for
 thread creation, then uses format to construct a name for the new
 thread. | 
NamingThreadFactory(String format,
                    ThreadFactory backingFactory)
 
          Creates a new factory that delegates to backingFactory for thread
 creation, then uses format to construct a name for the new thread. | 
 
 
| Methods inherited from class java.lang.Object | 
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait | 
 
DEFAULT_FACTORY
public static final ThreadFactory DEFAULT_FACTORY
NamingThreadFactory
public NamingThreadFactory(String format)
- Creates a new factory that delegates to the default thread factory for
 thread creation, then uses 
format to construct a name for the new
 thread.
- Parameters:
 format - a String.format(String, Object...)-compatible format
     String, to which a unique integer (0, 1, etc.) will be supplied as the
     single parameter. This integer will be unique to this instance of
     NamingThreadFactory and will be assigned sequentially.
 
NamingThreadFactory
public NamingThreadFactory(String format,
                           ThreadFactory backingFactory)
- Creates a new factory that delegates to 
backingFactory for thread
 creation, then uses format to construct a name for the new thread.
- Parameters:
 format - a String.format(String, Object...)-compatible format
     String, to which a unique integer (0, 1, etc.) will be supplied as the
     single parameterbackingFactory - the factory that will actually create the threads
- Throws:
 IllegalFormatException - if format is invalid
 
newThread
public Thread newThread(Runnable r)
- Specified by:
 newThread in interface ThreadFactory