|
1 | 1 |
|
2 | 2 | ### easter_eggs_for_java_loom |
3 | 3 |
|
4 | | -- examples re: [Project Loom](https://openjdk.org/projects/loom/) in JDK 21 |
| 4 | +- examples re: [Project Loom](https://openjdk.org/projects/loom/) |
5 | 5 | - usage of *egg* here is intended as an [SSCCE](http://sscce.org/); **not** a [hidden feature](https://en.wikipedia.org/wiki/Easter_egg_(media)) |
6 | 6 |
|
7 | | -### Notes |
| 7 | +### Notes, SEP 2025 |
| 8 | + |
| 9 | +* SEP 2025: see `jdk-25` branch for Java 25 (work in progress) |
| 10 | +* eggs work with Bash, Gradle, or Maven |
| 11 | + |
| 12 | +### Index |
| 13 | + |
| 14 | +* egg_1_max_p_threads |
| 15 | + * demo max # of platform threads |
| 16 | +* egg_2_max_v_threads |
| 17 | + * demo max # of virtual threads |
| 18 | +* egg_3_legacy_exec |
| 19 | + * illustrates legacy executor/thread pool |
| 20 | +* egg_4_virtual_exec |
| 21 | + * illustrates virtual threads via ExecutorService |
| 22 | +* egg_5_sc_invoke_all |
| 23 | + * structured concurrency |
| 24 | + * two tasks: `foo` and `bar` |
| 25 | + - can be configured to succeed or fail |
| 26 | + - when one task is configured to fail, the other is interrupted |
| 27 | +* egg_6_sc_invoke_any |
| 28 | + * structured concurrency |
| 29 | + * task `foo` and task `bar` are in a race: first one to complete is used; the other is interrupted |
| 30 | +* egg_7_sc_deadline |
| 31 | + * illustrates structured concurrency |
| 32 | + * task `foo` and task `bar` take too long and exceed a deadline |
| 33 | + - both are interrupted |
| 34 | +* egg_8_sc_custom_invoke_some |
| 35 | + * this egg illustrates structured concurrency |
| 36 | + * create `T` tasks |
| 37 | + - use a custom `StructuredTaskScope.Joiner` to define success when `n` tasks complete |
| 38 | + - if familiar with `invokeAny()` and `invokeAll()`, this could be considered `invokeSome(n)` |
| 39 | + * NOTE: highly contrived and NOT production-ready |
| 40 | +* egg_9_sc_fan_in |
| 41 | + * simple `client` to send messages over a socket to a `server` |
| 42 | + * NOTE: highly contrived and NOT production-ready |
| 43 | +* others |
| 44 | + * see `jdk-19` branch |
| 45 | + * these may not have been moved to `jdk-21` and definitely not `jdk-25` |
| 46 | + |
| 47 | +### Notes, SEP 2023 |
8 | 48 |
|
9 | 49 | * as of September 2023, these work using Bash but not Gradle or Maven |
10 | 50 | * GitHub actions are broken, pending availability of JDK 21 |
|
15 | 55 | * see README for each example |
16 | 56 | * test message |
17 | 57 |
|
18 | | -### Workflows |
19 | | - |
20 | | -* create token on GitHub for workflow scope |
21 | | -* use `git remote set-url origin https://codetojoy:[email protected]/codetojoy/easter_eggs_for_java_loom.git` |
22 | | - |
23 | | - |
24 | | -### Resources |
25 | | - |
26 | | -* JEP 425 [Virtual Threads](https://openjdk.java.net/jeps/425) |
27 | | -* JEP 428 [Structured Concurrency](https://openjdk.java.net/jeps/428) |
28 | | -* Brian Goetz on [Virtual Threads](https://www.infoq.com/articles/java-virtual-threads/) |
29 | | -* [Java 19 Virtual Threads - JEP Café](https://www.youtube.com/watch?v=lKSSBvRDmTg) |
30 | | -* [Project Loom: Modern Scalable Concurrency for the Java Platform](https://www.youtube.com/watch?v=EO9oMiL1fFo) by Ron Pressler |
31 | | - - 12m00s : "codes like sync, scales like async" |
32 | | - - 12m34s : excellent discussion on Thread vs async/await in various languages |
33 | | - - 30m44s : great slides illustrating 1:1 versus M:N |
34 | | - - 37m34s : Little's Law |
35 | | -* [Project Loom: Revolution in concurrency or obscure implementation detail?](https://www.youtube.com/watch?v=n_XRUljffu0) by Tomasz Nurkiewicz |
36 | | - - contrarian view |
37 | | -* [Project Loom - A Friend or Foe of Reactive?](https://www.youtube.com/watch?v=YwG04UZP2a0) by Oleh Dokuka and Andrii Rodionov |
38 | | - - contrarian view |
39 | | - - esp. near 19m20s |
40 | | -* [AMA About the Java Language](https://www.youtube.com/watch?v=9si7gK94gLo) by Brian Goetz and Nicolai Parlog |
41 | | - - near 19m10s, "Loom will kill Reactive programming" |
42 | | - - reddit thread [here](https://www.reddit.com/r/programming/comments/oxsnqg/brian_goetz_i_think_project_loom_is_going_to_kill/) |
43 | | -* [Project Loom Q&A with Ron Pressler](https://www.youtube.com/watch?v=cAHW96omBAc) |
44 | | - - esp. near 55m25s |
45 | | -* [Project Loom C5M](https://github.com/ebarlas/project-loom-c5m) |
46 | | - - 5 million concurrent connections |
47 | | -* [Conway's Game of Life with virtual threads](https://github.com/ebarlas/game-of-life-csp) |
48 | | -* blog post: [Notes on structured concurrency, or: Go statement considered harmful](https://vorpus.org/blog/notes-on-structured-concurrency-or-go-statement-considered-harmful) by Nathaniel J. Smith |
|
0 commit comments