public class ExecutorThreadFactory extends Object implements ThreadFactory
The thread factory can be given an Thread.UncaughtExceptionHandler
for the threads.
If no handler is explicitly given, the default handler for uncaught exceptions will log
the exceptions and kill the process afterwards. That guarantees that critical exceptions are
not accidentally lost and leave the system running in an inconsistent state.
Threads created by this factory are all called '(pool-name)-thread-n', where (pool-name) is configurable, and n is an incrementing number.
All threads created by this factory are daemon threads and have the default (normal) priority.
Constructor and Description |
---|
ExecutorThreadFactory()
Creates a new thread factory using the default thread pool name ('flink-executor-pool')
and the default uncaught exception handler (log exception and kill process).
|
ExecutorThreadFactory(String poolName)
Creates a new thread factory using the given thread pool name and the default
uncaught exception handler (log exception and kill process).
|
ExecutorThreadFactory(String poolName,
Thread.UncaughtExceptionHandler exceptionHandler)
Creates a new thread factory using the given thread pool name and the given
uncaught exception handler.
|
public ExecutorThreadFactory()
public ExecutorThreadFactory(String poolName)
poolName
- The pool name, used as the threads' name prefixpublic ExecutorThreadFactory(String poolName, Thread.UncaughtExceptionHandler exceptionHandler)
poolName
- The pool name, used as the threads' name prefixexceptionHandler
- The uncaught exception handler for the threadspublic Thread newThread(Runnable runnable)
newThread
in interface ThreadFactory
Copyright © 2014–2018 The Apache Software Foundation. All rights reserved.