Hacker News Re-Imagined

Show HN: Starter examples for Project Loom in Java 19

  • 1 points
  • 9 days ago

  • @codetojoy
  • Created a post

Show HN: Starter examples for Project Loom in Java 19


@codetojoy 9 days

Replying to @codetojoy 🎙

My project might help those getting started with Project Loom in JDK 19. A set of small, self-contained examples (SSCCEs) that can accelerate your own experimentation, especially if using SDKMan!. No IDE, no Gradle, no Maven.

Examples illustrate both "virtual threads" (preview status) and structured concurrency (incubator status).

Some of the more interesting examples:

Example #7 launches two tasks with a deadline to complete.

Example #8 implements a custom `StructuredTaskScope` that acts as `invokeSome(n)`. i.e. for M tasks, success is defined when N tasks complete.

Example #10 creates a small hierarchy within a `StructuredTaskScope` and then illustrates that `jcmd` can be used to interrogate the JVM for parent-child relationships.

The examples are highly contrived (often from the JEP docs), and NOT production-grade!

Reply


About Us

site design / logo © 2022 Box Piper