Class Log4jThreadFactory
java.lang.Object
org.apache.logging.log4j.core.util.Log4jThreadFactory
- All Implemented Interfaces:
ThreadFactory
Creates
Log4jThreads.- Since:
- 2.7
-
Constructor Summary
ConstructorsConstructorDescriptionLog4jThreadFactory(String threadFactoryName, boolean daemon, int priority) Constructs an initialized thread factory. -
Method Summary
Modifier and TypeMethodDescriptionstatic Log4jThreadFactorycreateDaemonThreadFactory(String threadFactoryName) Creates a new daemon thread factory.static Log4jThreadFactorycreateThreadFactory(String threadFactoryName) Creates a new thread factory.
-
Constructor Details
-
Log4jThreadFactory
Constructs an initialized thread factory.- Parameters:
threadFactoryName- The thread factory name.daemon- Whether to create daemon threads.priority- The thread priority.
-
-
Method Details
-
createDaemonThreadFactory
Creates a new daemon thread factory.- Parameters:
threadFactoryName- The thread factory name.- Returns:
- a new daemon thread factory.
-
createThreadFactory
Creates a new thread factory. This is mainly used for tests. Production code should be very careful with creating non-daemon threads since those will block application shutdown (see https://issues.apache.org/jira/browse/LOG4J2-1748).- Parameters:
threadFactoryName- The thread factory name.- Returns:
- a new daemon thread factory.
-
newThread
- Specified by:
newThreadin interfaceThreadFactory
-