Class ThreadHelper
java.lang.Object
org.apache.groovy.util.concurrent.ThreadHelper
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 TypeMethodDescriptionstatic ThreadstartThread(Runnable task) Starts a new thread to execute the given task.
-
Method Details
-
startThread
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
-