Class ThreadRenamingRunnable
- java.lang.Object
-
- org.threadly.concurrent.wrapper.traceability.ThreadRenamingRunnable
-
- All Implemented Interfaces:
java.lang.Runnable
,RunnableContainer
public class ThreadRenamingRunnable extends java.lang.Object implements java.lang.Runnable, RunnableContainer
A simple runnable wrapper which will rename the thread during execution, and set the name back at the end of execution.- Since:
- 4.8.0 (since 4.3.0 as org.threadly.concurrent.ThreadRenamingRunnableWrapper)
-
-
Constructor Summary
Constructors Constructor Description ThreadRenamingRunnable(java.lang.Runnable runnable, java.lang.String threadName, boolean replace)
Constructs a newThreadRenamingRunnable
.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.lang.Runnable
getContainedRunnable()
Call to get the contained runnable within the wrapper.void
run()
-
-
-
Constructor Detail
-
ThreadRenamingRunnable
public ThreadRenamingRunnable(java.lang.Runnable runnable, java.lang.String threadName, boolean replace)
Constructs a newThreadRenamingRunnable
. Ifreplace
isfalse
the thread will be named such thatthreadName[originalThreadName]
.- Parameters:
runnable
- Runnable which should be executedthreadName
- Thread name prefix, or replaced namereplace
- Iftrue
the original name wont be included in the thread name
-
-
Method Detail
-
run
public void run()
- Specified by:
run
in interfacejava.lang.Runnable
-
getContainedRunnable
public java.lang.Runnable getContainedRunnable()
Description copied from interface:RunnableContainer
Call to get the contained runnable within the wrapper.- Specified by:
getContainedRunnable
in interfaceRunnableContainer
- Returns:
- runnable contained, or
null
if none is contained
-
-