Class 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)
    • 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()  
      • Methods inherited from class java.lang.Object

        equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • ThreadRenamingRunnable

        public ThreadRenamingRunnable​(java.lang.Runnable runnable,
                                      java.lang.String threadName,
                                      boolean replace)
        Constructs a new ThreadRenamingRunnable. If replace is false the thread will be named such that threadName[originalThreadName].
        Parameters:
        runnable - Runnable which should be executed
        threadName - Thread name prefix, or replaced name
        replace - If true the original name wont be included in the thread name
    • Method Detail

      • run

        public void run()
        Specified by:
        run in interface java.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 interface RunnableContainer
        Returns:
        runnable contained, or null if none is contained