Package io.javago

Class Go

java.lang.Object
io.javago.Go

public class Go extends Object
The Go class implements Go's go statement. It provides a simple way to execute tasks asynchronously using a virtual thread per task executor. It initializes a thread pool and ensures that it is properly shut down when the JVM exits.

This class is intended to be used for running Runnable tasks in a multi-threaded environment.

See Also:
  • Method Details

    • go

      public static void go(Runnable r)
      Executes the given task asynchronously using the thread pool. Used to recreate Go's go keyword in Java.
      Parameters:
      r - the task to be executed
      Throws:
      NullPointerException - if the task is null