Browse Clojure Foundations for Java Developers

State Management and Concurrency

Manage state explicitly with atoms, refs, agents, and channels on the JVM.

Immutability does not mean “no state.” It means state changes are explicit and controlled. Clojure gives you a small set of concurrency tools that each map to a real style of state: independent updates, coordinated updates, asynchronous work, and message-passing.

For Java engineers, this chapter connects familiar pain points (locks, shared mutable objects, race conditions) to Clojure’s model: change state by applying pure functions to values, and choose the right coordination tool for the job.

By the end, you should be able to look at a concurrent problem and decide whether it needs an atom, a ref/STM transaction, an agent, or a channel-based architecture.

In this section

Revised on Friday, April 24, 2026