https://github.com/dgroomes/java-concurrency-playground
📚 Learning and exploring concurrency in Java
https://github.com/dgroomes/java-concurrency-playground
completable-future java java-concurrency
Last synced: 2 months ago
JSON representation
📚 Learning and exploring concurrency in Java
- Host: GitHub
- URL: https://github.com/dgroomes/java-concurrency-playground
- Owner: dgroomes
- Created: 2019-09-07T21:32:20.000Z (almost 6 years ago)
- Default Branch: main
- Last Pushed: 2024-11-17T01:31:37.000Z (7 months ago)
- Last Synced: 2025-03-25T11:39:06.507Z (3 months ago)
- Topics: completable-future, java, java-concurrency
- Language: Java
- Homepage:
- Size: 188 KB
- Stars: 2
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# java-concurrency-playground
📚 Learning and exploring concurrency in Java.
## Standalone subprojects
This repository illustrates different concepts, patterns and examples via standalone subprojects. Each subproject is
completely independent of the others and do not depend on the root project. This _standalone subproject constraint_
forces the subprojects to be complete and maximizes the reader's chances of successfully running, understanding, and
re-using the code.The subprojects include:
### `virtual-threads/`
A simple demonstration of virtual threads.
See the README in [virtual-threads/](virtual-threads/).
### `interrupts/`
Learning about interrupts .
See the README in [interrupts/](interrupts/).
### `completable-future/`
Simulate the execution of long-running work and show the power of `CompletableFuture` to execute that work concurrently.
See the README in [completable-future/](completable-future/).
### `timer/`
Learning about `java.util.Timer` .
and related APIs.See the README in [timer/](timer/).
### `signals/`
Learning how signals, like `SIGINT`, are handled by a Java program.
See the README in [signals/](signals/).
## Wish List
General clean-ups, TODOs and things I wish to implement for this project:
* [x] DONE Rename `loom` to `virtual-threads`
* [x] DONE Configure `loom/virtual-threads` as a Gradle subproject
* [x] DONE Upgrade to Gradle 8.5
* [x] DONE Upgrade to Java 21
* [x] DONE Unnest the `src/main/java` dirs in the non-Gradle native projects. We're only using Gradle as a way for the IDE
to understand the project structure, but I don't want to pay the price of having to have a `src/main/java` dir in these
projects.
* [x] DONE Move `mock-api` to my `wiremock-playground` repo. I originally included it here as a way to explore completable futures
with a workload I was familiar with in real work, but I can de-scope it now and instead create an in-process mock API
using timers or something. Or better yet sleeps and virtual threads.
* [ ] Show how to use `sun.misc.Signal` instead of just a shutdown hook. While the `sun` package feels like an overall
no-no because of the name plus the very frowned-upon `sun.misc.Unsafe`, `sun.misc.Signal` is a well-implemented,
reasonable, and platform-independent thing/API and it's doubtful that it will be wholesale removed. I think there's
just not enough motivation to change it. Maybe they'll move it to a different package some day. Either way, the API is
great.