Package javascalautils.concurrent
Class NamedSequenceThreadFactory
- java.lang.Object
-
- javascalautils.concurrent.NamedSequenceThreadFactory
-
- All Implemented Interfaces:
java.util.concurrent.ThreadFactory
public final class NamedSequenceThreadFactory extends java.lang.Object implements java.util.concurrent.ThreadFactory
Thread factory for providing meaningful names to the created threads.
All threads created through this factory will be given a unique identifier based on a sequence counter.
E.g. providing the nameMyThread
will yield threads calledMyThread-n
, where n is the sequence counter for created threads.
The counter starts at 1, thus the naming series will be threadName-[1-n]- Since:
- 1.2
-
-
Constructor Summary
Constructors Constructor Description NamedSequenceThreadFactory(java.lang.String threadName)
Create the factory.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.lang.Thread
newThread(java.lang.Runnable runnable)
Creates a new thread using the provided name and sequence counter.
-