Watchmaker Framework API
(Version 0.6.2)

org.uncommons.util.concurrent
Class ConfigurableThreadFactory

java.lang.Object
  extended by org.uncommons.util.concurrent.ConfigurableThreadFactory
All Implemented Interfaces:
ThreadFactory

public class ConfigurableThreadFactory
extends Object
implements ThreadFactory

Thread factory that creates threads for use by a ThreadPoolExecutor. The factory can be configured to customise the names, priority and daemon status of created threads.

Author:
Daniel Dyer

Constructor Summary
ConfigurableThreadFactory(String namePrefix, int priority, boolean daemon)
           
ConfigurableThreadFactory(String namePrefix, int priority, boolean daemon, Thread.UncaughtExceptionHandler uncaughtExceptionHandler)
           
 
Method Summary
 Thread newThread(Runnable runnable)
          Creates a new thread configured according to this factory's parameters.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ConfigurableThreadFactory

public ConfigurableThreadFactory(String namePrefix,
                                 int priority,
                                 boolean daemon)
Parameters:
namePrefix - The String prefix used to assign identifiers to created threads.
priority - The initial priority for created threads.
daemon - Whether or not created threads should be daemon threads or user threads. The JVM exits when the only threads running are all daemon threads.

ConfigurableThreadFactory

public ConfigurableThreadFactory(String namePrefix,
                                 int priority,
                                 boolean daemon,
                                 Thread.UncaughtExceptionHandler uncaughtExceptionHandler)
Parameters:
namePrefix - The String prefix used to assign identifiers to created threads.
priority - The initial priority for created threads.
daemon - Whether or not created threads should be daemon threads or user threads. The JVM exits when the only threads running are all daemon threads.
uncaughtExceptionHandler - A strategy for dealing with uncaught exceptions.
Method Detail

newThread

public Thread newThread(Runnable runnable)
Creates a new thread configured according to this factory's parameters.

Specified by:
newThread in interface ThreadFactory
Parameters:
runnable - The runnable to be executed by the new thread.
Returns:
The created thread.

Watchmaker Framework API
(Version 0.6.2)