org.webbitserver.helpers
Class NamingThreadFactory

java.lang.Object
  extended by org.webbitserver.helpers.NamingThreadFactory
All Implemented Interfaces:
ThreadFactory

public class NamingThreadFactory
extends Object
implements ThreadFactory

Wraps a ThreadFactory and assigns a name to each newly created thread, that includes two counters: one to indicate which ThreadFactory instance this is, and another for the thread created by the factory.


Constructor Summary
NamingThreadFactory(String prefix)
           
NamingThreadFactory(ThreadFactory factory, String prefix)
           
 
Method Summary
 Thread newThread(Runnable r)
           
protected  String threadName()
          Override this method to customize thread name.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

NamingThreadFactory

public NamingThreadFactory(ThreadFactory factory,
                           String prefix)

NamingThreadFactory

public NamingThreadFactory(String prefix)
Method Detail

newThread

public Thread newThread(Runnable r)
Specified by:
newThread in interface ThreadFactory

threadName

protected String threadName()
Override this method to customize thread name.



Copyright © 2013. All Rights Reserved.