Lab 15: Capstone — Production Order Service

Objective

Build a production-grade order processing service that combines: virtual threads for high concurrency, dynamic proxies for audit logging, ForkJoinPool for parallel analytics, AES-256-GCM encryption for sensitive data, SQLite window functions for reporting, and sealed ADTs for type-safe event modelling.

Background

This capstone integrates techniques from all 14 preceding labs into one coherent mini-application. Real-world services blend concurrency, security, persistence, and clean architecture simultaneously. After completing this lab, you'll have a reference design for Java 21 service architecture.

Time

45 minutes

Prerequisites

  • All Java Advanced labs 01–14

Tools

  • Docker: zchencow/innozverse-java:latest

  • SQLite JDBC (via Maven)


Lab Instructions

The Service Architecture

Step 1–8: Full service implementation

💡 Virtual threads + dynamic proxy + ForkJoin = 3 orthogonal concerns. Virtual threads handle concurrency (blocking I/O without thread exhaustion). Dynamic proxy handles cross-cutting concerns (audit, auth, metrics) without changing business logic. ForkJoin handles CPU-bound parallelism (analytics). These three patterns don't interfere with each other — they compose cleanly because each operates at a different layer.

📸 Verified Output:


What You Built

Component
Lab Origin
Purpose

Virtual Threads

Lab 02

50 concurrent non-blocking orders

Dynamic Proxy

Lab 01

Audit logging without business logic change

AES-256-GCM

Lab 06

Payment data encryption

ForkJoinPool

Lab 08

Parallel revenue analytics

JDBC + Window Functions

Lab 05

Ranked revenue report

Sealed ADT

Lab 13

Type-safe OrderEvent hierarchy

Congratulations! 🎉

You've completed all 15 Java Advanced labs. You now have working knowledge of:

  • Reflection & metaprogramming — dynamic proxies, annotation frameworks

  • Concurrency — virtual threads, locks, semaphores, ForkJoin, Phaser

  • Security — full JCA/JCE cryptography stack

  • Performance — NIO, ForkJoin, benchmarking, profiling

  • Modern Java — records, sealed classes, pattern matching, text blocks

Further Reading

Last updated