Concurrency For Humans
summary
Advocates thinking in tasks not threads: use ExecutorServices (cached vs fixed), prefer invokeAll/invokeAny for batches, and avoid creating millions of OS threads. Demonstrates CompletableFuture pipelines and async supplyAsync but warns CompletableFuture cancellation doesn't propagate to tasks (executor futures cancel via interrupt). Shows parallel streams work only on splittable, substantial in-memory data. Benchmarks: counting "String" in JDK sources ≈83,000 occurrences takes ~40s; prime check from 1,000,000,000 to +5,000,000 finds ~241,000 primes (seq 32s, parallel 24s).
AI-written summary · about
