public class LoggingThreadFactory extends Object implements ThreadFactory, Thread.UncaughtExceptionHandler
Thread.UncaughtExceptionHandler to threads it creates so that there are logs of the
exceptions that cause threads to die.
Use this class when providing a thread factory to threadpools.
This factory's constructor can be told to create daemon or non-daemon threads.
| Constructor and Description |
|---|
LoggingThreadFactory(String poolName,
boolean daemon)
Creates a factory that will produce either daemon or non-daemon threads.
|
public LoggingThreadFactory(String poolName, boolean daemon)
false for the daemon parameter; if you do, make sure your thread pool and all its threads
created by this factory are properly shutdown; otherwise you could prevent the VM from exiting properly.poolName - the name of the thread pool that will be using this factorydaemon - if true, the factory will create daemon threads; false for non-daemon
threadspublic Thread newThread(Runnable r)
newThread in interface ThreadFactoryThreadFactory.newThread(Runnable)public void uncaughtException(Thread t, Throwable e)
uncaughtException in interface Thread.UncaughtExceptionHandlerThread.UncaughtExceptionHandler.uncaughtException(Thread, Throwable)Copyright © 2008-2014 Red Hat, Inc.. All Rights Reserved.