Browse Clojure Foundations for Java Developers

Practical Examples of Concurrency

Apply atoms/refs/agents to realistic problems like counters, caches, and coordination.

Concurrency becomes learnable when you apply it to concrete tasks.

Expect examples in this section to look like real JVM work:

  • rate limiting / counters (atoms)
  • cache state and invalidation (atoms + pure transforms)
  • coordinated money/account transfers (refs + STM)
  • background event capture and batching (agents)
  • producer/consumer pipelines (channels or queues)

Do the examples in a REPL and deliberately provoke contention—Java developers often learn the most when they see which invariants break (or do not) under load.

In this section

Revised on Friday, April 24, 2026