Back to projects

Java · Executable Java lab

Java Concurrency Lab

Production-minded Java 21 examples for virtual threads, single flight, bounded resources, cancellation, and deterministic tests.

The challenge

More concurrency improves throughput only when scarce dependencies, cancellation, and failure propagation remain controlled.

The result

Small reusable primitives and an executable aggregation example with focused race tests.

What this project demonstrates

Reviewable decisions instead of slogans.

  • Virtual threads with explicit capacity limits
  • Single-flight coalescing for identical requests
  • Deadlines, cooperative cancellation, and fail-fast groups

Technologies

  • Java 21
  • Virtual Threads
  • Maven
  • JUnit