Package io.javago
Class Go
java.lang.Object
io.javago.Go
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 Summary
-
Method Details
-
go
Executes the given task asynchronously using the thread pool. Used to recreate Go'sgokeyword in Java.- Parameters:
r- the task to be executed- Throws:
NullPointerException- if the task is null
-