Class ThreadUtils

java.lang.Object
com.illumon.util.thread.ThreadUtils

public class ThreadUtils extends Object
Collection of thread related utility methods.
  • Constructor Details

    • ThreadUtils

      public ThreadUtils()
  • Method Details

    • newDaemonThread

      public static Thread newDaemonThread(@NotNull Runnable r)
      Create a thread and make it a daemon.
      Parameters:
      r - the runnable to pass the new Thread
      Returns:
      the created thread
    • newDaemonThread

      public static Thread newDaemonThread(@NotNull Runnable r, @NotNull String name)
      Create a thread, name it, and make it a daemon.
      Parameters:
      r - the runnable to pass the new Thread
      name - the name of the thread
      Returns:
      the created thread
    • startDaemonThread

      public static Thread startDaemonThread(@NotNull Runnable target, @NotNull String name)
      Create a named daemon thread and start it.
      Parameters:
      target - the runnable to pass the new Thread
      name - the name of the thread
      Returns:
      the created thread, started