Package net.kolotyluk.loom
Class Experiment00_Introduction
java.lang.Object
net.kolotyluk.loom.Experiment00_Introduction
Introductory loom-lab Experiment
This experiment is a quick way to jump into Project Loom, because we're here to 'il-loom-inate' things 😉
This is one of the most simple Project-Loom experiments that shows something interesting. When we run it we should see something like:
item = 3, Thread ID = Thread[#1,main,5,main] item = 4, Thread ID = Thread[#1,main,5,main] item = 5, Thread ID = Thread[#1,main,5,main] task = 1, Thread ID = VirtualThread[#17]/runnable@ForkJoinPool-1-worker-2 task = 0, Thread ID = VirtualThread[#15]/runnable@ForkJoinPool-1-worker-9 item = 6, Thread ID = Thread[#1,main,5,main] item = 7, Thread ID = Thread[#1,main,5,main] . . . [task 0 result, task 1 result, ..., task 14 result, task 15 result]Where we just print some information on which thread the code is running on; the indented lines were spawned by the unindented lines. Note how there are two types of Threads, Platform Threads such as Thread[#1,main,5,main] and Virtual Threads such as VirtualThread[#17], where Virtual Threads are the new feature of Project Loom. Other new features we see here include
StructuredExecutor
PREVIEW.
-
Constructor Summary
-
Method Summary
-
Constructor Details
-
Experiment00_Introduction
public Experiment00_Introduction()
-
-
Method Details
-
main
-