Package org.apache.groovy.util.concurrent

# Class ThreadHelper

java.lang.Object
org.apache.groovy.util.concurrent.ThreadHelper

public final class ThreadHelper extends Object
Helper for starting threads that prefers virtual threads when running on Java 21+, falling back to platform threads on older runtimes.

Since:
  6.0.0

- ## Method Summary

  Modifier and Type
  Method
  Description
  `static Thread`
  `startThread(Runnable task)`
  Starts a new thread to execute the given task.

  ### Methods inherited from class java.lang.Object

  `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- ## Method Details

  - ### startThread

    public static Thread startThread(Runnable task)
    Starts a new thread to execute the given task. Uses a virtual thread on Java 21+, otherwise a platform thread.
    Parameters:
      `task` - the runnable to execute
    Returns:
      the started thread