public class ThreadFactoryWithNamePrefix
extends java.lang.Object
implements java.util.concurrent.ThreadFactory
Executors.defaultThreadFactory() from JDK8, except for the thread naming feature.
The factory creates threads that have names on the form prefix-N-thread-M, where prefix is a string provided in the constructor, N is the sequence number of this factory, and M is the sequence number of the thread created by this factory.
| Constructor and Description |
|---|
ThreadFactoryWithNamePrefix(java.lang.String prefix)
Creates a new ThreadFactory where threads are created with a name prefix of
prefix. |
| Modifier and Type | Method and Description |
|---|---|
java.lang.Thread |
newThread(java.lang.Runnable r) |
public ThreadFactoryWithNamePrefix(java.lang.String prefix)
prefix.prefix - Thread name prefix. Never use a value of "pool" as in that case you might as well have used
Executors.defaultThreadFactory().Copyright © 2019. All rights reserved.