How leonardoz/java-concurrency-patterns works
Main architectural view
• This is a single Maven-based Java project.
• It exposes two logical modules of code under the package root br.com.leonardoz:
• features (concrete usage examples of Java concurrency APIs)
• patterns (higher-level concurrency design patterns)
Major components
A. Developer / Consumer (External actor)
– Clones or forks the GitHub repository.
– Uses Maven to build, run, or import examples into an IDE.
B. Source Repository
– Top-level project containing pom.xml, README.md, and the src tree.
C. Build System (Maven)
– Reads pom.xml: compiles all Java packages, runs any tests, packages examples into a JAR (if configured).
D. JDK Concurrency API (External library)
– The java.util.concurrent package and related APIs that every sample depends on.
E. Example Modules (Internal code components)
1. Features Module
– Subpackages:
• threads
• locks (intrinsic, reentrant, read-write)
• synchronizers (latches, barriers, semaphores)
• collections (synchronized, concurrent)
• executors (all ExecutorService variants)
• futures (FutureTask, CompletableFuture)
• forkjoin
• parallel_stream
• java_memory_model
• atomics
2. Patterns Module
– Subpackages implementing thread-safe design patterns:
• shared-state protection
• atomic compound actions
• lock splitting
• fixed lock ordering
• thread-local confinement
• immutable objects
• lazy initialization
• safe publishing
• resource pools
• condition queues (wait/notify, await/signal)
• background task executor
• task cancel/convergence
• producer-consumer, divide-and-conquer, non-blocking, etc.
Relationships and interactions
• Developer → (clone/pull) → Source Repository
• Source Repository → (invoke) → Maven Build
• Maven Build → (compile/link) → Example Modules + JDK Concurrency API
• Maven Build → (package) → deliverable JAR or IDE project
• Developer → (run/examples) → Example Modules → console output
Architectural patterns and design principles
• The project is structured by package grouping, not by services or layers.
• It follows modular separation of “features” vs “patterns.”
• Each subpackage is a self-contained example, depending only on the JDK.