Appendix 1Clojure Agents

Clojure agents[24] represent a single identity or location in memory. Recollect that STM’s refs manage coordinated synchronous changes to multiple identities. Agents allow independent asynchronous changes to the individual identities they manage. The changes are expressed in the form of functions or actions that are applied to that location asynchronously. Multiple independent concurrent actions are run in sequence, one after the other. Upon successful completion of an action, an agent is changed to the new state returned by the action. This new state is used for subsequent reads or subsequent actions on the agent.

The calls to run actions on an agent return immediately. The action is then applied on the agent using ...

Get Programming Concurrency on the JVM now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.